MCPcopy
hub / github.com/django/django / test_alternatives

Method test_alternatives

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

Source from the content-addressed store, hash-verified

728 self.assertIn(html_content, msg.message().as_string())
729
730 def test_alternatives(self):
731 msg = EmailMultiAlternatives()
732 html_content = "<p>This is <strong>html</strong></p>"
733 mime_type = "text/html"
734 msg.attach_alternative(html_content, mime_type)
735
736 self.assertIsInstance(msg.alternatives[0], EmailAlternative)
737
738 self.assertEqual(msg.alternatives[0][0], html_content)
739 self.assertEqual(msg.alternatives[0].content, html_content)
740
741 self.assertEqual(msg.alternatives[0][1], mime_type)
742 self.assertEqual(msg.alternatives[0].mimetype, mime_type)
743
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>"

Callers

nothing calls this directly

Calls 4

attach_alternativeMethod · 0.95
messageMethod · 0.80
as_stringMethod · 0.45

Tested by

no test coverage detected