mirror of
https://github.com/pretix/pretix.git
synced 2026-08-07 10:17:49 +00:00
add testcase for fallback to order.email
This commit is contained in:
@@ -463,6 +463,59 @@ def test_sendmail_rule_not_checked_in_mixed_order(event, order, item):
|
||||
sendmail_run_rules(None)
|
||||
assert len(djmail.outbox) == 1
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@scopes_disabled()
|
||||
def test_sendmail_rule_not_checked_in_mixed_order_position_without_email_not_matching_status(event, order, item, item2):
|
||||
order.status = Order.STATUS_PAID
|
||||
order.save()
|
||||
p1 = order.all_positions.create(item=item, price=13, attendee_email='item1@dummy.test')
|
||||
p2 = order.all_positions.create(item=item, price=13, attendee_email='item2@dummy.test')
|
||||
clist = event.checkin_lists.create(name="Default", all_products=True)
|
||||
|
||||
# receives no mail when checked in
|
||||
djmail.outbox = []
|
||||
perform_checkin(p1, clist, {})
|
||||
|
||||
# we have no email and we are checked in
|
||||
# we shouldn't trigger a fallback to order.email
|
||||
p3 = order.all_positions.create(item=item, price=13)
|
||||
perform_checkin(p3, clist, {})
|
||||
assert clist.checkin_count == 2
|
||||
|
||||
event.sendmail_rules.create(send_date=dt_now - datetime.timedelta(hours=1), checked_in_status="no_checkin",
|
||||
subject='meow', template='meow meow meow', send_to=Rule.ATTENDEES)
|
||||
sendmail_run_rules(None)
|
||||
|
||||
assert len(djmail.outbox) == 1
|
||||
recipients = [m.to for m in djmail.outbox]
|
||||
assert [p2.attendee_email] in recipients # for p2
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@scopes_disabled()
|
||||
def test_sendmail_rule_not_checked_in_mixed_order_position_without_email(event, order, item, item2):
|
||||
order.status = Order.STATUS_PAID
|
||||
order.save()
|
||||
p1 = order.all_positions.create(item=item, price=13, attendee_email='item1@dummy.test')
|
||||
p2 = order.all_positions.create(item=item, price=13, attendee_email='item2@dummy.test')
|
||||
p3 = order.all_positions.create(item=item, price=13)
|
||||
p4 = order.all_positions.create(item=item, price=13)
|
||||
clist = event.checkin_lists.create(name="Default", all_products=True)
|
||||
|
||||
# receives no mail when checked in
|
||||
djmail.outbox = []
|
||||
perform_checkin(p1, clist, {})
|
||||
assert clist.checkin_count == 1
|
||||
event.sendmail_rules.create(send_date=dt_now - datetime.timedelta(hours=1), checked_in_status="no_checkin",
|
||||
subject='meow', template='meow meow meow', send_to=Rule.ATTENDEES)
|
||||
sendmail_run_rules(None)
|
||||
|
||||
assert len(djmail.outbox) == 2
|
||||
recipients = [m.to for m in djmail.outbox]
|
||||
assert [order.email] in recipients # for p3 and p4
|
||||
assert [p2.attendee_email] in recipients # for p2
|
||||
|
||||
@pytest.mark.django_db
|
||||
@scopes_disabled()
|
||||
def run_restriction_test(event, order, restrictions_pass=[], restrictions_fail=[]):
|
||||
|
||||
Reference in New Issue
Block a user