MCPcopy
hub / github.com/django/django / test_multipart_with_attachments

Method test_multipart_with_attachments

tests/mail/tests.py:719–728  ·  view source on GitHub ↗

EmailMultiAlternatives includes alternatives if the body is empty and it has attachments.

(self)

Source from the content-addressed store, hash-verified

717 )
718
719 def test_multipart_with_attachments(self):
720 """
721 EmailMultiAlternatives includes alternatives if the body is empty and
722 it has attachments.
723 """
724 msg = EmailMultiAlternatives(body="")
725 html_content = "<p>This is <strong>html</strong></p>"
726 msg.attach_alternative(html_content, "text/html")
727 msg.attach("example.txt", "Text file content", "text/plain")
728 self.assertIn(html_content, msg.message().as_string())
729
730 def test_alternatives(self):
731 msg = EmailMultiAlternatives()

Callers

nothing calls this directly

Calls 5

attach_alternativeMethod · 0.95
attachMethod · 0.80
messageMethod · 0.80
as_stringMethod · 0.45

Tested by

no test coverage detected