diff --git a/tests/test_meta_project.py b/tests/test_meta_project.py index 5c372dcccf5756ebac80640d709f158bccbdfc54..5149e356d4634bb31118c0e14ad93861cc9e6334 100644 --- a/tests/test_meta_project.py +++ b/tests/test_meta_project.py @@ -90,6 +90,8 @@ def test_invalid_values_on_transactions(hook, src_value): ('Assets:Receivable:Accounts', True), ('Assets:Receivable:Loans', True), ('Equity:OpeningBalance', False), + ('Equity:Funds:Restricted', True), + ('Equity:Funds:Unrestricted', False), ('Expenses:General', True), ('Income:Donations', True), ('Liabilities:CreditCard', False), @@ -154,3 +156,13 @@ def test_invalid_project_data(repo_path_s, data_path_s): config = testutil.TestConfig(repo_path=repo_path_s) with pytest.raises(errormod.ConfigurationError): meta_project.MetaProject(config, Path(data_path_s)) + +def test_not_required_on_opening(hook): + txn = testutil.Transaction.opening_balance('Equity:Funds:Unrestricted') + assert not list(hook.run(txn)) + +def test_always_required_on_restricted_funds(hook): + acct = 'Equity:Funds:Restricted' + txn = testutil.Transaction.opening_balance(acct) + actual = {error.message for error in hook.run(txn)} + assert actual == {f'{acct} missing project'}