@@ -566,6 +566,46 @@ def test_outgoing_report_multi_invoice(accrual_postings, caplog):
}}
assert 'payment-method:' not in output.getvalue()
@pytest.mark.parametrize('arg', [
'usd ach',
' eur wire',
'cad vendorportal ',
' gbp check ',
])
def test_outgoing_report_good_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 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
'',
'usd',
'usd nonexistent',
'check',
'us check',
def test_outgoing_report_bad_payment_method(caplog, accrual_postings, arg):
assert caplog.records
for log in caplog.records:
assert log.levelname == 'WARNING'
assert log.message.startswith(f'cannot set payment-method for {rt_id}: ')
assert 'CF_payment-method' not in rt_client.edits[rt_id[3:]]
def test_outgoing_report_without_rt_id(accrual_postings, caplog):
invoice = 'rt://ticket/515/attachments/5150'
related = accruals_by_meta(