diff --git a/tests/test_reports_accrual.py b/tests/test_reports_accrual.py index c4392fc165cb5283570b40fb52adce2cc85d568d..2c5d3af9c5818816e1ade0cc3b1718d86b1609b2 100644 --- a/tests/test_reports_accrual.py +++ b/tests/test_reports_accrual.py @@ -309,6 +309,30 @@ def test_accrual_postings_inconsistent_account(): related = accrual.AccrualPostings(data.Posting.from_txn(txn)) assert related.account is related.INCONSISTENT +def test_accrual_postings_rt_id(): + txn = testutil.Transaction(postings=[ + (ACCOUNTS[0], 10, {'rt-id': 'rt:90'}), + (ACCOUNTS[0], 10, {'rt-id': 'rt:90 rt:92'}), + (ACCOUNTS[0], 10, {'rt-id': 'rt:90 rt:94 rt:92'}), + ]) + related = accrual.AccrualPostings(data.Posting.from_txn(txn)) + assert related.rt_id == 'rt:90' + +def test_accrual_postings_rt_id_inconsistent(): + txn = testutil.Transaction(postings=[ + (ACCOUNTS[0], 10, {'rt-id': 'rt:96'}), + (ACCOUNTS[0], 10, {'rt-id': 'rt:98 rt:96'}), + ]) + related = accrual.AccrualPostings(data.Posting.from_txn(txn)) + assert related.rt_id is related.INCONSISTENT + +def test_accrual_postings_rt_id_none(): + txn = testutil.Transaction(postings=[ + (ACCOUNTS[0], 10), + ]) + related = accrual.AccrualPostings(data.Posting.from_txn(txn)) + assert related.rt_id is None + @pytest.mark.parametrize('acct_name,invoice,day', testutil.combine_values( ACCOUNTS, ['FIXME', '', None, *testutil.NON_STRING_METADATA_VALUES],