@@ -214,6 +214,16 @@ def test_which_accounts_required_on(hook, account, required):
assert any(error.message == "{} missing entity".format(account)
for error in errors)
def test_dont_set_entity_none(hook):
txn = testutil.Transaction(postings=[
('Expenses:Other', 5),
('Assets:Cash', -5),
])
assert any(hook.run(txn))
assert 'entity' not in txn.meta
for post in txn.postings:
assert post.meta is None or 'entity' not in post.meta
def test_not_required_on_opening(hook):
txn = testutil.OpeningBalance()
assert not list(hook.run(txn))