Fix sendmail/scheduled-mails preview event-based placeholders

* Fix sendmail/scheduled-mails placeholders

* Add event_or_subevent to context

* Add placeholders to tests

* fix and improve test

* Revert "fix and improve test"

This reverts commit 874a11e982.

* undo placeholder-tests

* add test
This commit is contained in:
Richard Schreiber
2026-08-18 14:54:19 +02:00
committed by GitHub
parent 4dd6e1a19f
commit f9ea9de078
4 changed files with 17 additions and 6 deletions
+6 -2
View File
@@ -186,7 +186,7 @@ def test_sendmail_rule_send_order_vs_pos(send_to, amount_mails, recipients, orde
order.event.sendmail_rules.create(date_is_absolute=True, send_date=dt_now - datetime.timedelta(hours=1),
send_to=send_to,
subject='meow', template='meow meow meow')
subject='{event}: {event_location} @ {event_admission_time}', template='meow meow meow')
order.all_positions.create(item=item, price=0, attendee_email='meow@dummy.test')
sendmail_run_rules(None)
@@ -196,6 +196,8 @@ def test_sendmail_rule_send_order_vs_pos(send_to, amount_mails, recipients, orde
_recipients = [mail.to[0] for mail in djmail.outbox]
assert set(recipients) == set(_recipients)
assert djmail.outbox[0].subject == 'Dummy: Foo City @ 11:30'
@pytest.mark.django_db
@scopes_disabled()
@@ -243,7 +245,7 @@ def test_sendmail_rule_send_correct_subevent(order, event_series, subevent1, sub
event_series.sendmail_rules.create(date_is_absolute=False, offset_is_after=False, send_offset_days=2,
send_offset_time=datetime.time(9, 30), send_to=Rule.ATTENDEES,
subject='meow', template='meow meow meow')
subject='{event}: {event_location} @ {event_admission_time}', template='meow meow meow')
p1 = order.all_positions.create(item=item, price=13, attendee_email='se1@dummy.test', subevent=subevent1)
order.all_positions.create(item=item, price=23, attendee_email='se2@dummy.test', subevent=subevent2)
@@ -253,6 +255,8 @@ def test_sendmail_rule_send_correct_subevent(order, event_series, subevent1, sub
assert djmail.outbox[0].to[0] == p1.attendee_email
assert djmail.outbox[0].subject == 'Meow: Meow Town @ 10:00'
@pytest.mark.django_db
@scopes_disabled()