Reusable Media: Mifare Ultralight AES support (#3335)

This commit is contained in:
Raphael Michel
2023-07-21 13:45:42 +02:00
committed by GitHub
parent b134f29cf6
commit 52023cde09
18 changed files with 554 additions and 12 deletions

View File

@@ -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():