mirror of
https://github.com/pretix/pretix.git
synced 2026-05-03 14:54:04 +00:00
Auto-check-in for specific sales channels (#1409)
* Autocheckin data model/cosmetics * Expose automatically checked-in OrderPositions * Expose automatically checked-in OrderPositions in CSV/PDF Exports * Fix some tests, try to fix MultiStringField/CheckboxSelectMultiple * Actually fix MultiStringField/CheckboxSelectMultiple. (Not pretty, but it works) * Fix more tests * Squash migration * Also fix CSV/nameparts-test * Changes for Autocheckin code-review * Perform Auto-Checkins through new core plugin * Update config-doc to reflect also checkinlists * Explicitly output AutoCheckin Yes/No for CSV-Export (+ fix test) * Move autocheckin from plugin to service * API-doc * Fix API-doc spelling * Checkinlist-API and autocheckin order tests * Performance improvement when reading checkinlists for autocheckin Co-Authored-By: Raphael Michel <michel@rami.io> * Autocheckin test for order created through API * Resolve migration conflict
This commit is contained in:
committed by
Raphael Michel
parent
05a1df244b
commit
748a389acb
@@ -147,6 +147,7 @@ def test_list_list(token_client, organizer, event, clist, item, subevent):
|
||||
res = dict(TEST_LIST_RES)
|
||||
res["id"] = clist.pk
|
||||
res["limit_products"] = [item.pk]
|
||||
res["auto_checkin_sales_channels"] = []
|
||||
|
||||
resp = token_client.get('/api/v1/organizers/{}/events/{}/checkinlists/'.format(organizer.slug, event.slug))
|
||||
assert resp.status_code == 200
|
||||
@@ -171,6 +172,7 @@ def test_list_detail(token_client, organizer, event, clist, item):
|
||||
|
||||
res["id"] = clist.pk
|
||||
res["limit_products"] = [item.pk]
|
||||
res["auto_checkin_sales_channels"] = []
|
||||
resp = token_client.get('/api/v1/organizers/{}/events/{}/checkinlists/{}/'.format(organizer.slug, event.slug,
|
||||
clist.pk))
|
||||
assert resp.status_code == 200
|
||||
@@ -196,6 +198,27 @@ def test_list_create(token_client, organizer, event, item, item_on_wrong_event):
|
||||
assert cl.limit_products.count() == 1
|
||||
assert not cl.all_products
|
||||
|
||||
resp = token_client.post(
|
||||
'/api/v1/organizers/{}/events/{}/checkinlists/'.format(organizer.slug, event.slug),
|
||||
{
|
||||
"name": "VIP",
|
||||
"limit_products": [item.pk],
|
||||
"all_products": False,
|
||||
"subevent": None,
|
||||
"auto_checkin_sales_channels": [
|
||||
"web"
|
||||
]
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 201
|
||||
with scopes_disabled():
|
||||
cl = CheckinList.objects.get(pk=resp.data['id'])
|
||||
assert cl.name == "VIP"
|
||||
assert cl.limit_products.count() == 1
|
||||
assert not cl.all_products
|
||||
assert "web" in cl.auto_checkin_sales_channels
|
||||
|
||||
resp = token_client.post(
|
||||
'/api/v1/organizers/{}/events/{}/checkinlists/'.format(organizer.slug, event.slug),
|
||||
{
|
||||
@@ -224,6 +247,24 @@ def test_list_create_with_subevent(token_client, organizer, event, event3, item,
|
||||
)
|
||||
assert resp.status_code == 201
|
||||
|
||||
resp = token_client.post(
|
||||
'/api/v1/organizers/{}/events/{}/checkinlists/'.format(organizer.slug, event.slug),
|
||||
{
|
||||
"name": "VIP",
|
||||
"limit_products": [item.pk],
|
||||
"all_products": True,
|
||||
"subevent": subevent.pk,
|
||||
"auto_checkin_sales_channels": [
|
||||
"web"
|
||||
]
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 201
|
||||
with scopes_disabled():
|
||||
cl = CheckinList.objects.get(pk=resp.data['id'])
|
||||
assert "web" in cl.auto_checkin_sales_channels
|
||||
|
||||
resp = token_client.post(
|
||||
'/api/v1/organizers/{}/events/{}/checkinlists/'.format(organizer.slug, event.slug),
|
||||
{
|
||||
@@ -278,6 +319,20 @@ def test_list_update(token_client, organizer, event, clist):
|
||||
cl = CheckinList.objects.get(pk=resp.data['id'])
|
||||
assert cl.name == "VIP"
|
||||
|
||||
resp = token_client.patch(
|
||||
'/api/v1/organizers/{}/events/{}/checkinlists/{}/'.format(organizer.slug, event.slug, clist.pk),
|
||||
{
|
||||
"auto_checkin_sales_channels": [
|
||||
"web"
|
||||
],
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
with scopes_disabled():
|
||||
cl = CheckinList.objects.get(pk=resp.data['id'])
|
||||
assert "web" in cl.auto_checkin_sales_channels
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_list_all_items_positions(token_client, organizer, event, clist, clist_all, item, other_item, order):
|
||||
@@ -316,7 +371,8 @@ def test_list_all_items_positions(token_client, organizer, event, clist, clist_a
|
||||
p1['checkins'] = [
|
||||
{
|
||||
'list': clist_all.pk,
|
||||
'datetime': c.datetime.isoformat().replace('+00:00', 'Z')
|
||||
'datetime': c.datetime.isoformat().replace('+00:00', 'Z'),
|
||||
'auto_checked_in': False
|
||||
}
|
||||
]
|
||||
resp = token_client.get('/api/v1/organizers/{}/events/{}/checkinlists/{}/positions/?has_checkin=1'.format(
|
||||
@@ -353,7 +409,8 @@ def test_list_all_items_positions(token_client, organizer, event, clist, clist_a
|
||||
p2['checkins'] = [
|
||||
{
|
||||
'list': clist_all.pk,
|
||||
'datetime': c.datetime.isoformat().replace('+00:00', 'Z')
|
||||
'datetime': c.datetime.isoformat().replace('+00:00', 'Z'),
|
||||
'auto_checked_in': False
|
||||
}
|
||||
]
|
||||
resp = token_client.get(
|
||||
|
||||
Reference in New Issue
Block a user