API: Fix using invoice address attributes in "include"

This commit is contained in:
Raphael Michel
2022-12-16 15:23:20 +01:00
parent 8dd83e5a35
commit 6a4b792501
2 changed files with 17 additions and 4 deletions

View File

@@ -479,15 +479,19 @@ def test_include_exclude_fields(token_client, organizer, event, order, item, tax
assert 'url' not in resp.data
assert 'positions' not in resp.data
resp = token_client.get('/api/v1/organizers/{}/events/{}/orders/{}/?include=email&include=positions&exclude=positions.secret'.format(
organizer.slug, event.slug, order.code
))
resp = token_client.get(
'/api/v1/organizers/{}/events/{}/orders/{}/?include=email&include=positions&include=invoice_address.name&exclude=positions.secret'.format(
organizer.slug, event.slug, order.code
)
)
assert resp.status_code == 200
assert 'email' in resp.data
assert 'url' not in resp.data
assert 'positions' in resp.data
assert 'subevent' in resp.data['positions'][0]
assert 'secret' not in resp.data['positions'][0]
assert 'city' not in resp.data['invoice_address']
assert 'name' in resp.data['invoice_address']
resp = token_client.get('/api/v1/organizers/{}/events/{}/orders/{}/?include=email&include=positions.subevent'.format(
organizer.slug, event.slug, order.code