mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Reusable Media: Mifare Ultralight AES support (#3335)
This commit is contained in:
@@ -334,7 +334,7 @@ def test_medium_lookup_not_found(token_client, organizer, organizer2, medium):
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_medium_autocreate(token_client, organizer):
|
||||
def test_medium_lookup_autocreate(token_client, organizer):
|
||||
# Disabled
|
||||
resp = token_client.post(
|
||||
'/api/v1/organizers/{}/reusablemedia/lookup/'.format(organizer.slug),
|
||||
@@ -379,6 +379,28 @@ def test_medium_autocreate(token_client, organizer):
|
||||
assert resp.data["result"] is None
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_medium_autocreate_giftcard(token_client, organizer):
|
||||
organizer.settings.reusable_media_type_nfc_mf0aes_autocreate_giftcard = True
|
||||
organizer.settings.reusable_media_type_nfc_mf0aes_autocreate_giftcard_currency = 'USD'
|
||||
resp = token_client.post(
|
||||
'/api/v1/organizers/{}/reusablemedia/?expand=linked_giftcard'.format(organizer.slug),
|
||||
{
|
||||
"type": "nfc_mf0aes",
|
||||
"identifier": "AABBCCDD",
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 201
|
||||
res = resp.data
|
||||
with scopes_disabled():
|
||||
m = ReusableMedium.objects.get(pk=res["id"])
|
||||
assert res["identifier"] == "AABBCCDD" == m.identifier
|
||||
assert res["type"] == "nfc_mf0aes" == m.type
|
||||
assert res["linked_giftcard"]["value"] == "0.00"
|
||||
assert res["linked_giftcard"]["currency"] == "USD"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_medium_lookup_cross_organizer(token_client, organizer, organizer2, org2_event, medium2, giftcard2):
|
||||
with scopes_disabled():
|
||||
|
||||
Reference in New Issue
Block a user