mirror of
https://github.com/pretix/pretix.git
synced 2026-05-03 14:54:04 +00:00
Automated emails: Extend filter by check-in state (#3489)
Co-authored-by: Richard Schreiber <schreiber@rami.io> Co-authored-by: Raphael Michel <michel@rami.io>
This commit is contained in:
@@ -39,7 +39,8 @@ TEST_RULE_RES = {
|
||||
'template': {'en': 'foo'},
|
||||
'all_products': True,
|
||||
'limit_products': [],
|
||||
"restrict_to_status": ['p', 'n__valid_if_pending'],
|
||||
'restrict_to_status': ['p', 'n__valid_if_pending'],
|
||||
'checked_in_status': None,
|
||||
'send_date': '2021-07-08T00:00:00Z',
|
||||
'send_offset_days': None,
|
||||
'send_offset_time': None,
|
||||
@@ -160,7 +161,8 @@ def test_sendmail_rule_create_full(token_client, organizer, event, item):
|
||||
'template': {'en': 'foobar'},
|
||||
'all_products': False,
|
||||
'limit_products': [event.items.first().pk],
|
||||
"restrict_to_status": ['p', 'n__not_pending_approval_and_not_valid_if_pending', 'n__valid_if_pending'],
|
||||
'restrict_to_status': ['p', 'n__not_pending_approval_and_not_valid_if_pending', 'n__valid_if_pending'],
|
||||
'checked_in_status': None,
|
||||
'send_offset_days': 3,
|
||||
'send_offset_time': '09:30',
|
||||
'date_is_absolute': False,
|
||||
@@ -174,6 +176,7 @@ def test_sendmail_rule_create_full(token_client, organizer, event, item):
|
||||
assert r.all_products is False
|
||||
assert [i.pk for i in r.limit_products.all()] == [event.items.first().pk]
|
||||
assert r.restrict_to_status == ['p', 'n__not_pending_approval_and_not_valid_if_pending', 'n__valid_if_pending']
|
||||
assert r.checked_in_status is None
|
||||
assert r.send_offset_days == 3
|
||||
assert r.send_offset_time == datetime.time(9, 30)
|
||||
assert r.date_is_absolute is False
|
||||
@@ -348,6 +351,49 @@ def test_sendmail_rule_restrict_recipients(token_client, organizer, event, rule)
|
||||
)
|
||||
|
||||
|
||||
@scopes_disabled()
|
||||
@pytest.mark.django_db
|
||||
def test_sendmail_rule_checkin(token_client, organizer, event, rule):
|
||||
valid_states = [None, 'checked_in', 'no_checkin', ]
|
||||
invalid_states = ['', 'foo']
|
||||
|
||||
for s in valid_states:
|
||||
result = create_rule(
|
||||
token_client, organizer, event,
|
||||
data={
|
||||
'subject': {'en': 'meow'},
|
||||
'template': {'en': 'creative text here'},
|
||||
'send_date': '2018-03-17T13:31Z',
|
||||
'checked_in_status': s,
|
||||
},
|
||||
expected_failure=False
|
||||
)
|
||||
assert result.checked_in_status == s
|
||||
|
||||
for s in invalid_states:
|
||||
create_rule(
|
||||
token_client, organizer, event,
|
||||
data={
|
||||
'subject': {'en': 'meow'},
|
||||
'template': {'en': 'creative text here'},
|
||||
'send_date': '2018-03-17T13:31Z',
|
||||
'checked_in_status': s,
|
||||
},
|
||||
expected_failure=True
|
||||
)
|
||||
|
||||
result = create_rule(
|
||||
token_client, organizer, event,
|
||||
data={
|
||||
'subject': {'en': 'meow'},
|
||||
'template': {'en': 'creative text here'},
|
||||
'send_date': '2018-03-17T13:31Z',
|
||||
},
|
||||
expected_failure=False
|
||||
)
|
||||
assert result.checked_in_status is None
|
||||
|
||||
|
||||
@scopes_disabled()
|
||||
@pytest.mark.django_db
|
||||
def test_sendmail_rule_change(token_client, organizer, event, rule):
|
||||
|
||||
Reference in New Issue
Block a user