File diff d8df34ebaf6f → f66460f34304
tests/test_reports_accrual.py
Show inline comments
...
 
@@ -68,6 +68,7 @@ class RTClient(testutil.RTClient):
 
            ('6100', 'invoice may.pdf', 'application/pdf', '1.6m'),
 
        ],
 
        '515': [],
 
        '520': [],
 
    }
 

	
 

	
...
 
@@ -281,7 +282,7 @@ def test_outgoing_report(accrual_postings):
 
    check_output(output, [
 
        r'^PAYMENT FOR APPROVAL:$',
 
        r'^REQUESTOR: Mx\. 510 <mx510@example\.org>$',
 
        r'^TOTAL TO PAY: 280\.00 USD$',
 
        r'^TOTAL TO PAY: \$280\.00$',
 
        fr'^AGREEMENT: {contract_url}',
 
        r'^PAYMENT TO: Hon\. Mx\. 510$',
 
        r'^PAYMENT METHOD: payment method 510$',
...
 
@@ -316,6 +317,25 @@ def test_outgoing_report_custom_field_fallbacks(accrual_postings):
 
        r'^PAYMENT METHOD:\s*$',
 
    ])
 

	
 
def test_outgoing_report_fx_amounts(accrual_postings):
 
    invoice = 'rt:520/5200'
 
    related = core.RelatedPostings(
 
        post for post in accrual_postings
 
        if post.meta.get('invoice') == invoice
 
        and post.account.is_under('Assets:Receivable', 'Liabilities:Payable')
 
    )
 
    output = io.StringIO()
 
    errors = io.StringIO()
 
    rt_client = RTClient()
 
    rt_cache = rtutil.RT(rt_client)
 
    accrual.outgoing_report({invoice: related}, output, errors, rt_client, rt_cache)
 
    assert not errors.getvalue()
 
    check_output(output, [
 
        r'^PAYMENT FOR APPROVAL:$',
 
        r'^REQUESTOR: Mx\. 520 <mx520@example\.org>$',
 
        r'^TOTAL TO PAY: 1,000\.00 EUR \(\$1,100.00\)$',
 
    ])
 

	
 
def run_main(arglist, config=None):
 
    if config is None:
 
        config = testutil.TestConfig(
...
 
@@ -375,7 +395,7 @@ def test_main_outgoing_report(arglist):
 
    contract_url = re.escape(f'<{rt_url}Ticket/Attachment/4000/4000/contract.pdf>')
 
    check_output(output, [
 
        r'^REQUESTOR: Mx\. 510 <mx510@example\.org>$',
 
        r'^TOTAL TO PAY: 280\.00 USD$',
 
        r'^TOTAL TO PAY: \$280\.00$',
 
        r'^\s*2020-06-12\s',
 
        r'^\s+Expenses:FilingFees\s+60\.00 USD$',
 
    ])