mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Gift card API: Allow to inspect transactions (#1868)
This commit is contained in:
@@ -186,3 +186,26 @@ def test_giftcard_no_deletion(token_client, organizer, event, giftcard):
|
||||
'/api/v1/organizers/{}/giftcards/{}/'.format(organizer.slug, giftcard.pk),
|
||||
)
|
||||
assert resp.status_code == 405
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_giftcard_transactions(token_client, organizer, giftcard):
|
||||
resp = token_client.get(
|
||||
'/api/v1/organizers/{}/giftcards/{}/transactions/'.format(organizer.slug, giftcard.pk),
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
assert resp.data == {
|
||||
"count": 1,
|
||||
"next": None,
|
||||
"previous": None,
|
||||
"results": [
|
||||
{
|
||||
"id": giftcard.transactions.first().pk,
|
||||
"datetime": giftcard.transactions.first().datetime.isoformat().replace("+00:00", "Z"),
|
||||
"value": "23.00",
|
||||
"event": None,
|
||||
"order": None,
|
||||
"text": None
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -148,6 +148,8 @@ org_permission_sub_urls = [
|
||||
('get', 'can_manage_gift_cards', 'giftcards/1/', 404),
|
||||
('put', 'can_manage_gift_cards', 'giftcards/1/', 404),
|
||||
('patch', 'can_manage_gift_cards', 'giftcards/1/', 404),
|
||||
('get', 'can_manage_gift_cards', 'giftcards/1/transactions/', 404),
|
||||
('get', 'can_manage_gift_cards', 'giftcards/1/transactions/1/', 404),
|
||||
('get', 'can_change_organizer_settings', 'devices/', 200),
|
||||
('post', 'can_change_organizer_settings', 'devices/', 400),
|
||||
('get', 'can_change_organizer_settings', 'devices/1/', 404),
|
||||
|
||||
Reference in New Issue
Block a user