diff --git a/tests/test_reports_accrual.py b/tests/test_reports_accrual.py index 8b90dbb43bcf5c00ea39089d3dab602536b70ef2..147b479802e1b07055c0e616966da4317429ffa6 100644 --- a/tests/test_reports_accrual.py +++ b/tests/test_reports_accrual.py @@ -121,7 +121,7 @@ AGING_AR = [ AgingRow.make_simple('2010-03-05', 'EarlyBird', -500, 'rt:40/400'), AgingRow.make_simple('2010-05-15', 'MatchingProgram', 1500, 'rt://ticket/515/attachments/5150'), - AgingRow.make_simple('2010-06-15', 'GrantCo', 5500, 'rt:470/4700', + AgingRow.make_simple('2010-06-15', 'GrantCo', 11500, 'rt:470/4700', project='Development Grant'), ] @@ -630,6 +630,11 @@ def test_aging_report(accrual_postings): def test_aging_report_date_cutoffs(accrual_postings, date, recv_end, pay_end): expect_recv = AGING_AR[:recv_end] expect_pay = AGING_AP[:pay_end] + if 10 <= date.day < 12: + # Take the 60 USD posting out of the invoice 510/6100 payable. + expect_pay[-1] = expect_pay[-1]._replace( + at_cost=testutil.Amount(expect_pay[-1].at_cost.number - 60), + ) output = run_aging_report(accrual_postings, date) check_aging_ods(output, date, expect_recv, expect_pay) @@ -644,6 +649,20 @@ def test_aging_report_entity_consistency(accrual_postings): AgingRow.make_simple('2010-04-15', 'MultiPartyB', 125, 'rt:480/4800'), ]) +def test_aging_report_does_not_include_too_recent_postings(accrual_postings): + # This date is after the Q3 posting, but too soon after for that to be + # included in the aging report. + date = datetime.date(2010, 10, 1) + output = run_aging_report(( + post for post in accrual_postings + if post.meta.get('rt-id') == 'rt:470' + ), date) + # Date+amount are both from the Q2 posting only. + check_aging_ods(output, date, [ + AgingRow.make_simple('2010-06-15', 'GrantCo', 5500, 'rt:470/4700', + project='Development Grant'), + ], []) + def run_main(arglist, config=None): if config is None: config = testutil.TestConfig(