API: Allow querying invoices with multiple order codes (Z#23158921) (#4332)

This commit is contained in:
Raphael Michel
2024-07-26 16:32:29 +02:00
committed by GitHub
parent a692940397
commit 17f1d571b0
4 changed files with 102 additions and 5 deletions

View File

@@ -311,6 +311,20 @@ def test_invoice_list(token_client, organizer, event, order, item, invoice):
assert [] == resp.data['results']
@pytest.mark.django_db
def test_invoice_list_multi_filter(token_client, organizer, event, order, order2, item, invoice, invoice2):
order2.event = event
order2.save()
invoice2.event = event
invoice2.save()
resp = token_client.get('/api/v1/organizers/{}/events/{}/invoices/?order=FOO'.format(organizer.slug, event.slug))
assert len(resp.data['results']) == 1
resp = token_client.get('/api/v1/organizers/{}/events/{}/invoices/?order=BAR'.format(organizer.slug, event.slug))
assert len(resp.data['results']) == 1
resp = token_client.get('/api/v1/organizers/{}/events/{}/invoices/?order=FOO&order=BAR'.format(organizer.slug, event.slug))
assert len(resp.data['results']) == 2
@pytest.mark.django_db
def test_organizer_level(token_client, organizer, team, event, event2, invoice, invoice2):
resp = token_client.get('/api/v1/organizers/{}/invoices/'.format(organizer.slug))