Esempio n. 1
0
 def test_html_mail(self):
     email = EmailMessage(
         subject="test",
         template_base="djangobmf/tests/core/email/mail",
     )
     self.assertEqual(email.subject, "test")
     self.assertEqual(email.body, "HTMLMAIL")
     self.assertEqual(len(email.alternatives), 0)
Esempio n. 2
0
 def test_missing_template(self):
     email = EmailMessage(
         subject="test",
         body="test",
         template_base="djangobmf/tests/core/email/does_not_exist",
     )
     self.assertEqual(email.subject, "test")
     self.assertEqual(email.body, "test")
Esempio n. 3
0
 def test_auto_context(self):
     email = EmailMessage(
         subject="test_subject",
         body="test_body",
         template_base="djangobmf/tests/core/email/context",
     )
     self.assertEqual(email.subject, "test_subject")
     self.assertEqual(email.body, "test_body")
Esempio n. 4
0
 def test_plain_in_template(self):
     email = EmailMessage(
         subject="test",
         body="test",
         template_name="djangobmf/tests/core/email/plain_in_template.html",
     )
     self.assertEqual(email.subject, "test")
     self.assertEqual(email.body, "plainblock")
     self.assertEqual(email.alternatives, [])
Esempio n. 5
0
 def test_html_in_template(self):
     email = EmailMessage(
         subject="test",
         body="test",
         template_name="djangobmf/tests/core/email/html_in_template.html",
     )
     self.assertEqual(email.subject, "test")
     self.assertEqual(email.body, "test")
     self.assertEqual(len(email.alternatives), 1)
Esempio n. 6
0
 def test_subject_in_context(self):
     email = EmailMessage(
         subject="test_subject",
         body="test_body",
         template_name="djangobmf/tests/core/email/context.html",
         context={'subject': 'subject'},
     )
     self.assertEqual(email.subject, "subject")
     self.assertEqual(email.body, "test_body")
Esempio n. 7
0
 def test_overwrite_language(self):
     email = EmailMessage(
         template_base="djangobmf/tests/core/email/language",
         language='de',
     )
     self.assertEqual(email.subject, "Montag - Donnerstag")
Esempio n. 8
0
 def test_missing_template_name(self):
     email = EmailMessage(subject="test", body="test")
     self.assertEqual(email.subject, "test")
     self.assertEqual(email.body, "test")