Check-in: Fix crash on medium scan that is mapped to wrong event (PRETIXEU-9P0)

This commit is contained in:
Raphael Michel
2024-02-15 14:46:24 +01:00
parent 75b93eebc5
commit fa4c29cf23
2 changed files with 46 additions and 0 deletions

View File

@@ -308,6 +308,25 @@ def test_by_medium_not_connected(token_client, organizer, clist, event, order):
assert resp.data['reason'] == 'invalid'
@pytest.mark.django_db
def test_by_medium_wrong_event(token_client, organizer, clist, event, order2):
with scopes_disabled():
ReusableMedium.objects.create(
type="barcode",
identifier="abcdef",
organizer=organizer,
linked_orderposition=order2.positions.first(),
)
resp = _redeem(token_client, organizer, clist, "abcdef", {"source_type": "barcode"})
assert resp.status_code == 404
assert resp.data['status'] == 'error'
assert resp.data['reason'] == 'invalid'
with scopes_disabled():
ci = clist.checkins.get()
assert ci.raw_barcode == "abcdef"
assert ci.raw_source_type == "barcode"
@pytest.mark.django_db
def test_by_medium_wrong_type(token_client, organizer, clist, event, order):
with scopes_disabled():