mirror of
https://github.com/pretix/pretix.git
synced 2026-05-03 14:54:04 +00:00
Placeholders in subject were not being replaced because there was no `.format()` called on the subject. This commit creates a context dict that is used for both the body and the subject. It is then replaced using `.format_map()` Fixes https://github.com/pretix/pretix/issues/531
This commit is contained in:
committed by
Raphael Michel
parent
96dd4e02f3
commit
58938fc07c
@@ -89,3 +89,13 @@ def test_send_mail_with_user_locale(env):
|
||||
assert len(djmail.outbox) == 1
|
||||
assert djmail.outbox[0].subject == 'Benutzer'
|
||||
assert 'The language code used for rendering this e-mail is de.' in djmail.outbox[0].body
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_sendmail_placeholder(env):
|
||||
djmail.outbox = []
|
||||
event, user, organizer = env
|
||||
mail('dummy@dummy.dummy', '{event} Test subject', 'mailtest.txt', {"event": event}, event)
|
||||
|
||||
assert len(djmail.outbox) == 1
|
||||
assert djmail.outbox[0].to == [user.email]
|
||||
assert djmail.outbox[0].subject == 'Dummy Test subject'
|
||||
Reference in New Issue
Block a user