@@ -97,12 +97,22 @@ def test_bad_post_links(hook):
('Assets:Cash', 5),
])
expected = {NOT_FOUND_MSG(key, value) for key, value in meta.items()}
actual = {error.message for error in hook.run(txn)}
assert expected == actual
def test_flagged_txn_not_checked(hook):
keys = iter(METADATA_KEYS)
txn_meta = build_meta(keys, BAD_LINKS)
txn_meta['flag'] = '!'
txn = testutil.Transaction(**txn_meta, postings=[
('Income:Donations', -5, build_meta(keys, BAD_LINKS)),
('Assets:Checking', 5, build_meta(keys, BAD_LINKS)),
assert not list(hook.run(txn))
@pytest.mark.parametrize('value', testutil.NON_STRING_METADATA_VALUES)
def test_bad_metadata_type(hook, value):
txn = testutil.Transaction(**{'check': value}, postings=[
('Income:Donations', -5),