mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 11:51:05 -05:00
use_template_subject and use_template_from
Change "clear_subject" and "clear_from" to clarify expected usage. Update docs. Acknowledge contribution.
This commit is contained in:
@@ -31,15 +31,24 @@ class DjrillMandrillSendTemplateTests(DjrillBackendMockAPITestCase):
|
||||
msg = mail.EmailMessage('Subject', 'Text Body',
|
||||
'from@example.com', ['to@example.com'])
|
||||
msg.template_name = "PERSONALIZED_SPECIALS"
|
||||
msg.clear_from = True
|
||||
msg.clear_subject = True
|
||||
msg.use_template_from = True
|
||||
msg.send()
|
||||
self.assert_mandrill_called("/messages/send-template.json")
|
||||
data = self.get_api_call_data()
|
||||
self.assertEqual(data['template_name'], "PERSONALIZED_SPECIALS")
|
||||
self.assertEqual(data['message']['subject'], "")
|
||||
self.assertEqual(data['message']['from_email'], "")
|
||||
self.assertEqual(data['message']['from_name'], "")
|
||||
self.assertFalse('from_email' in data['message'])
|
||||
self.assertFalse('from_name' in data['message'])
|
||||
|
||||
def test_send_template_without_subject_field(self):
|
||||
msg = mail.EmailMessage('Subject', 'Text Body',
|
||||
'from@example.com', ['to@example.com'])
|
||||
msg.template_name = "PERSONALIZED_SPECIALS"
|
||||
msg.use_template_subject = True
|
||||
msg.send()
|
||||
self.assert_mandrill_called("/messages/send-template.json")
|
||||
data = self.get_api_call_data()
|
||||
self.assertEqual(data['template_name'], "PERSONALIZED_SPECIALS")
|
||||
self.assertFalse('subject' in data['message'])
|
||||
|
||||
def test_no_template_content(self):
|
||||
# Just a template, without any template_content to be merged
|
||||
|
||||
Reference in New Issue
Block a user