summaryrefslogtreecommitdiff
path: root/tests/mail
diff options
context:
space:
mode:
authorWilliams Mendez <wmendez27@gmail.com>2018-02-19 09:39:53 -0400
committerTim Graham <timograham@gmail.com>2018-02-20 09:34:01 -0500
commit2691ed7ba1a83c535acd4fe7f0864a279cec3c35 (patch)
treebf2dc489475a4c744746624d0f01239dc4e9d726 /tests/mail
parent548f78ba46efff5aa3613fc4d7f86c9166d349e4 (diff)
downloaddjango-2691ed7ba1a83c535acd4fe7f0864a279cec3c35.tar.gz
Fixed #29140 -- Fixed EmailMessage crash when body is None.
Diffstat (limited to 'tests/mail')
-rw-r--r--tests/mail/tests.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/mail/tests.py b/tests/mail/tests.py
index acce61cf9f..b8d0089ee3 100644
--- a/tests/mail/tests.py
+++ b/tests/mail/tests.py
@@ -357,6 +357,11 @@ class MailTests(HeadersCheckMixin, SimpleTestCase):
msg.attach('example.txt', 'Text file content', 'text/plain')
self.assertIn(html_content, msg.message().as_string())
+ def test_none_body(self):
+ msg = EmailMessage('subject', None, 'from@example.com', ['to@example.com'])
+ self.assertEqual(msg.body, '')
+ self.assertEqual(msg.message().get_payload(), '')
+
def test_encoding(self):
"""
Regression for #12791 - Encode body correctly with other encodings