test_meta_invoice: Add explicit "missing invoice" tests.

I wrote this while debugging something else, and I don't want to let
a good test go to waste.
This commit is contained in:
Brett Smith 2020-04-06 10:15:17 -04:00
parent 600c9d9d6f
commit 0d80c2282c

View file

@ -127,3 +127,15 @@ def test_bad_type_values_on_transaction(hook, acct1, acct2, value):
) )
actual = {error.message for error in hook.run(txn)} actual = {error.message for error in hook.run(txn)}
assert actual == {expected_msg} assert actual == {expected_msg}
@pytest.mark.parametrize('acct1,acct2', testutil.combine_values(
REQUIRED_ACCOUNTS,
NON_REQUIRED_ACCOUNTS,
))
def test_missing_invoice(hook, acct1, acct2):
txn = testutil.Transaction(postings=[
(acct2, -25),
(acct1, 25),
])
actual = {error.message for error in hook.run(txn)}
assert actual == {"{} missing {}".format(acct1, TEST_KEY)}