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)
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")
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")
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, [])
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)
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")
def test_overwrite_language(self): email = EmailMessage( template_base="djangobmf/tests/core/email/language", language='de', ) self.assertEqual(email.subject, "Montag - Donnerstag")
def test_missing_template_name(self): email = EmailMessage(subject="test", body="test") self.assertEqual(email.subject, "test") self.assertEqual(email.body, "test")