File diff 5ac2e4a87279 → 39a9d0d67ea5
tests/test_reports_query.py
Show inline comments
...
 
@@ -87,12 +87,13 @@ def test_rt_ticket_bad_metadata(ticket_query, meta_name):
 

	
 
@pytest.mark.parametrize('field_name,meta_name,expected', [
 
    ('id', 'rt-id', {1}),
 
    ('Queue', 'approval', {'general'}),
 
    ('Requestors', 'invoice', {'mx1@example.org', 'requestor2@example.org'}),
 
    ('Due', 'tax-reporting', {datetime.datetime(2017, 1, 14, 12, 1, 0, tzinfo=UTC)}),
 
    ('cf.{payment-to}', 'statement', {'Hon. Mx. 1'}),
 
])
 
def test_rt_ticket_from_txn(ticket_query, field_name, meta_name, expected):
 
    func = ticket_query(const_operands(field_name, meta_name))
 
    txn = testutil.Transaction(**{meta_name: 'rt:1'}, postings=[
 
        ('Assets:Cash', 80),
 
    ])
...
 
@@ -101,12 +102,13 @@ def test_rt_ticket_from_txn(ticket_query, field_name, meta_name, expected):
 

	
 
@pytest.mark.parametrize('field_name,meta_name,expected', [
 
    ('id', 'rt-id', {2}),
 
    ('Queue', 'approval', {'general'}),
 
    ('Requestors', 'invoice', {'mx2@example.org', 'requestor2@example.org'}),
 
    ('Due', 'tax-reporting', {datetime.datetime(2017, 1, 14, 12, 2, 0, tzinfo=UTC)}),
 
    ('CF_payment-to', 'statement', {'Hon. Mx. 2'}),
 
])
 
def test_rt_ticket_from_post(ticket_query, field_name, meta_name, expected):
 
    func = ticket_query(const_operands(field_name, meta_name))
 
    txn = testutil.Transaction(**{meta_name: 'rt:1'}, postings=[
 
        ('Assets:Cash', 110, {meta_name: 'rt:2/8'}),
 
    ])
...
 
@@ -118,12 +120,13 @@ def test_rt_ticket_from_post(ticket_query, field_name, meta_name, expected):
 
    ('Queue', 'check', {'general'}, False),
 
    ('Requestors', 'invoice', {
 
        'mx1@example.org',
 
        'mx2@example.org',
 
        'requestor2@example.org',
 
    }, False),
 
    ('cf_payment-to', 'statement', {'Hon. Mx. 1', 'Hon. Mx. 2'}, True),
 
])
 
def test_rt_ticket_multi_results(ticket_query, field_name, meta_name, expected, on_txn):
 
    func = ticket_query(const_operands(field_name, meta_name))
 
    txn = testutil.Transaction(**{'rt-id': 'rt:1'}, postings=[
 
        ('Assets:Cash', 110, {'rt-id': 'rt:2'}),
 
    ])