diff --git a/tests/test_reports_accrual.py b/tests/test_reports_accrual.py index 0e661f77563df7daf2b091f781dd3a084a8b2a45..1af316d940ba6dca473628ab4a9ba979b9e091a6 100644 --- a/tests/test_reports_accrual.py +++ b/tests/test_reports_accrual.py @@ -178,16 +178,16 @@ def test_filter_search(accrual_postings, search_terms, expect_count, check_func) assert check_func(post) @pytest.mark.parametrize('arg,expected', [ - ('balance', accrual.balance_report), - ('outgoing', accrual.outgoing_report), - ('bal', accrual.balance_report), - ('out', accrual.outgoing_report), - ('outgoings', accrual.outgoing_report), + ('balance', accrual.BalanceReport), + ('outgoing', accrual.OutgoingReport), + ('bal', accrual.BalanceReport), + ('out', accrual.OutgoingReport), + ('outgoings', accrual.OutgoingReport), ]) def test_report_type_by_name(arg, expected): - assert accrual.ReportType.by_name(arg.lower()) is expected - assert accrual.ReportType.by_name(arg.title()) is expected - assert accrual.ReportType.by_name(arg.upper()) is expected + assert accrual.ReportType.by_name(arg.lower()).value is expected + assert accrual.ReportType.by_name(arg.title()).value is expected + assert accrual.ReportType.by_name(arg.upper()).value is expected @pytest.mark.parametrize('arg', [ 'unknown', @@ -260,8 +260,8 @@ def run_outgoing(invoice, postings, rt_client=None): postings = relate_accruals_by_meta(postings, invoice) output = io.StringIO() errors = io.StringIO() - rt_cache = rtutil.RT(rt_client) - accrual.outgoing_report({invoice: postings}, output, errors, rt_client, rt_cache) + report = accrual.OutgoingReport(rt_client, output, errors) + report.run({invoice: postings}) return output, errors @pytest.mark.parametrize('invoice,expected', [ @@ -273,7 +273,10 @@ def run_outgoing(invoice, postings, rt_client=None): def test_balance_report(accrual_postings, invoice, expected): related = relate_accruals_by_meta(accrual_postings, invoice) output = io.StringIO() - accrual.balance_report({invoice: related}, output) + errors = io.StringIO() + report = accrual.BalanceReport(output, errors) + report.run({invoice: related}) + assert not errors.getvalue() check_output(output, [invoice, expected]) def test_outgoing_report(accrual_postings):