summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorkalombo <nogamemorebrain@gmail.com>2017-04-07 15:23:25 +0500
committerTim Graham <timograham@gmail.com>2017-04-07 18:02:34 -0400
commitdd001848920713fe616c03db6946762e8aa7c4e3 (patch)
tree085624b92dfd096dbeffa5b7adc9b52f1e22bf20 /tests
parentaedfe0ddd76fc37c83341c35c79ab63330ffded8 (diff)
Fixed #28042 -- Fixed crash when using a two-tuple in EmailMessage's attachments arg.
Diffstat (limited to 'tests')
-rw-r--r--tests/mail/tests.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/mail/tests.py b/tests/mail/tests.py
index 05fe61026f..50922e21d7 100644
--- a/tests/mail/tests.py
+++ b/tests/mail/tests.py
@@ -374,6 +374,13 @@ class MailTests(HeadersCheckMixin, SimpleTestCase):
self.assertEqual(payload[0].get_content_type(), 'multipart/alternative')
self.assertEqual(payload[1].get_content_type(), 'application/pdf')
+ def test_attachments_two_tuple(self):
+ msg = EmailMessage(attachments=[('filename1', 'content1')])
+ filename, content, mimetype = self.get_decoded_attachments(msg)[0]
+ self.assertEqual(filename, 'filename1')
+ self.assertEqual(content, b'content1')
+ self.assertEqual(mimetype, 'application/octet-stream')
+
def test_attachments_MIMEText(self):
txt = MIMEText('content1')
msg = EmailMessage(attachments=[txt])