mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Checkin: Allow to use presence state in rules (#4061)
This commit is contained in:
@@ -746,6 +746,33 @@ def test_rules_scan_days(event, position, clist):
|
||||
assert 'Maximum number of days with an entry exceeded.' in str(excinfo.value)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_rules_scan_entry_status(position, clist):
|
||||
# Ticket is valid three times
|
||||
clist.allow_multiple_entries = True
|
||||
clist.rules = {
|
||||
"or": [
|
||||
{"==": [{"var": "entry_status"}, "absent"]},
|
||||
{"<": [{"var": "entries_number"}, 1]}
|
||||
]
|
||||
}
|
||||
clist.save()
|
||||
|
||||
assert OrderPosition.objects.filter(SQLLogic(clist).apply(clist.rules), pk=position.pk).exists()
|
||||
perform_checkin(position, clist, {})
|
||||
|
||||
assert not OrderPosition.objects.filter(SQLLogic(clist).apply(clist.rules), pk=position.pk).exists()
|
||||
with pytest.raises(CheckInError) as excinfo:
|
||||
perform_checkin(position, clist, {})
|
||||
assert excinfo.value.code == 'rules'
|
||||
assert "Attendee is already checked in." in str(excinfo.value)
|
||||
|
||||
perform_checkin(position, clist, {}, type=Checkin.TYPE_EXIT)
|
||||
|
||||
assert OrderPosition.objects.filter(SQLLogic(clist).apply(clist.rules), pk=position.pk).exists()
|
||||
perform_checkin(position, clist, {})
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_rules_entries_since(event, position, clist):
|
||||
# Ticket is valid once before X and once after X
|
||||
|
||||
Reference in New Issue
Block a user