MCPcopy
hub / github.com/django/django / test_alternatives_constructor

Method test_alternatives_constructor

tests/mail/tests.py:746–762  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

744 self.assertIn(html_content, msg.message().as_string())
745
746 def test_alternatives_constructor(self):
747 html_content = "<p>This is <strong>html</strong></p>"
748 mime_type = "text/html"
749
750 msg = EmailMultiAlternatives(
751 alternatives=[EmailAlternative(html_content, mime_type)]
752 )
753
754 self.assertIsInstance(msg.alternatives[0], EmailAlternative)
755
756 self.assertEqual(msg.alternatives[0][0], html_content)
757 self.assertEqual(msg.alternatives[0].content, html_content)
758
759 self.assertEqual(msg.alternatives[0][1], mime_type)
760 self.assertEqual(msg.alternatives[0].mimetype, mime_type)
761
762 self.assertIn(html_content, msg.message().as_string())
763
764 def test_alternatives_constructor_from_tuple(self):
765 html_content = "<p>This is <strong>html</strong></p>"

Callers

nothing calls this directly

Calls 3

messageMethod · 0.80
as_stringMethod · 0.45

Tested by

no test coverage detected