tests: Test metadata deletion through iter_postings.

This commit is contained in:
Brett Smith 2020-03-17 17:47:00 -04:00
parent 3a73bc2239
commit e9096b9500

View file

@ -33,9 +33,14 @@ def test_iter_postings(simple_txn):
assert all(source[x] == post[x] for x in range(len(source) - 1))
assert post.meta['note'] # Only works with PostingMeta
def test_editing_metadata_edits_source(simple_txn):
def test_setting_metadata_propagates_to_source(simple_txn):
for index, post in enumerate(data.iter_postings(simple_txn)):
post.meta['edited'] = str(index)
for index, post in enumerate(simple_txn.postings):
assert post.meta['edited'] == str(index)
assert not isinstance(post.meta, data.PostingMeta)
def test_deleting_metadata_propagates_to_source(simple_txn):
posts = list(data.iter_postings(simple_txn))
del posts[1].meta['extra']
assert 'extra' not in simple_txn.postings[1].meta