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:24:09 -0400
commit734e6bb2b884eb4681954e1d0c01097fe167f558 (patch)
tree927ba102e2b0cc82635e4d47073036c855807454 /tests
parenta95eba7d98e73e03770c82fdea6d9c3573c79f5d (diff)
[1.11.x] Fixed #28042 -- Fixed crash when using a two-tuple in EmailMessage's attachments arg.
Backport of dd001848920713fe616c03db6946762e8aa7c4e3 from master
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 84e6934b52..7765a427c7 100644
--- a/tests/mail/tests.py
+++ b/tests/mail/tests.py
@@ -387,6 +387,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])