summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2016-11-10 14:07:19 +0100
committerClaude Paroz <claude@2xlibre.net>2016-11-10 19:47:02 +0100
commit8858631498bca33feb2acde71f9cf6ca2884b1bd (patch)
tree4ecfa77f49e8b3d223ce5b5d9e1d2d889acb43e6 /tests
parentac0cf97cb46a07f8f0bf50bac27db4ba2903a8ec (diff)
Fixed #27469 -- Prevented sending email to empty addresses
Thanks Jarek Glowacki for the report.
Diffstat (limited to 'tests')
-rw-r--r--tests/mail/tests.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/mail/tests.py b/tests/mail/tests.py
index e053a65d6a..51497d71cd 100644
--- a/tests/mail/tests.py
+++ b/tests/mail/tests.py
@@ -100,6 +100,22 @@ class MailTests(HeadersCheckMixin, SimpleTestCase):
self.assertEqual(message['From'], 'from@example.com')
self.assertEqual(message['To'], 'to@example.com, other@example.com')
+ def test_recipients_with_empty_strings(self):
+ """
+ Empty strings in various recipient arguments are always stripped
+ off the final recipient list.
+ """
+ email = EmailMessage(
+ 'Subject', 'Content', 'from@example.com', ['to@example.com', ''],
+ cc=['cc@example.com', ''],
+ bcc=['', 'bcc@example.com'],
+ reply_to=['', None],
+ )
+ self.assertEqual(
+ email.recipients(),
+ ['to@example.com', 'cc@example.com', 'bcc@example.com']
+ )
+
def test_cc(self):
"""Regression test for #7722"""
email = EmailMessage('Subject', 'Content', 'from@example.com', ['to@example.com'], cc=['cc@example.com'])