Changeset - 69d079190ce7
[Not reviewed]
0 1 0
Brett Smith - 4 years ago 2020-07-02 17:08:21
brettcsmith@brettcsmith.org
tests: Test non-string values for payment-method metadata.
1 file changed with 1 insertions and 0 deletions:
0 comments (0 inline, 0 general)
tests/test_reports_accrual.py
Show inline comments
...
 
@@ -582,24 +582,25 @@ def test_outgoing_report_good_payment_method(caplog, accrual_postings, arg):
 
    run_outgoing(rt_id, data.Posting.from_txn(txn), rt_client)
 
    assert not caplog.records
 
    cf_values = rt_client.edits[rt_id[3:]]['CF_payment-method'].split()
 
    assert cf_values[0] == arg.split()[0].upper()
 
    assert len(cf_values) > 1
 

	
 
@pytest.mark.parametrize('arg', [
 
    '',
 
    'usd',
 
    'usd nonexistent',
 
    'check',
 
    'us check',
 
    *testutil.NON_STRING_METADATA_VALUES,
 
])
 
def test_outgoing_report_bad_payment_method(caplog, accrual_postings, arg):
 
    rt_id = 'rt:40'
 
    meta = {'rt-id': rt_id, 'invoice': 'rt:40/100', 'payment-method': arg}
 
    txn = testutil.Transaction(postings=[
 
        ('Liabilities:Payable:Accounts', -100, meta),
 
    ])
 
    rt_client = RTClient()
 
    run_outgoing(rt_id, data.Posting.from_txn(txn), rt_client)
 
    assert caplog.records
 
    for log in caplog.records:
 
        assert log.levelname == 'WARNING'
0 comments (0 inline, 0 general)