-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: prepare email without template, but with context (#468)
- Loading branch information
Showing
2 changed files
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,20 @@ def test_email_message_render(self): | |
self.assertEqual(message.body, 'Content test') | ||
self.assertEqual(message.alternatives[0][0], 'HTML test') | ||
|
||
def test_email_message_prepare_without_template_and_with_context(self): | ||
""" | ||
Ensure Email instance without template but with context is properly prepared. | ||
""" | ||
context = {'name': 'test'} | ||
email = Email.objects.create(to=['[email protected]'], template=None, | ||
subject='Subject test', message='Content test', | ||
html_message='HTML test', | ||
from_email='[email protected]', context=context) | ||
message = email.email_message() | ||
self.assertEqual(message.subject, 'Subject test') | ||
self.assertEqual(message.body, 'Content test') | ||
self.assertEqual(message.alternatives[0][0], 'HTML test') | ||
|
||
def test_dispatch(self): | ||
""" | ||
Ensure that email.dispatch() actually sends out the email | ||
|