summaryrefslogtreecommitdiff
path: root/tests/mail
diff options
context:
space:
mode:
authorDenis Stebunov <denis.stebunov@ivelum.com>2018-12-23 03:06:56 +0200
committerTim Graham <timograham@gmail.com>2018-12-26 13:33:08 -0500
commit277de2298465496b58808d22f67963544c76b16a (patch)
tree676e1a2eb062f7d50aae3cc8063434773046c36a /tests/mail
parent0b54ab0675a5443dbda2fc48e98ab474c295ac0c (diff)
downloaddjango-277de2298465496b58808d22f67963544c76b16a.tar.gz
Fixed #30058 -- Made SMTP EmailBackend.send_messages() return 0 for empty/error cases.
Diffstat (limited to 'tests/mail')
-rw-r--r--tests/mail/tests.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/mail/tests.py b/tests/mail/tests.py
index ac44996ff9..f0f91e7b40 100644
--- a/tests/mail/tests.py
+++ b/tests/mail/tests.py
@@ -1527,7 +1527,12 @@ class SMTPBackendTests(BaseEmailBackendTests, SMTPBackendTestsBase):
backend.connection = True
backend.open = lambda: None
email = EmailMessage('Subject', 'Content', 'from@example.com', ['to@example.com'])
- self.assertEqual(backend.send_messages([email]), None)
+ self.assertEqual(backend.send_messages([email]), 0)
+
+ def test_send_messages_empty_list(self):
+ backend = smtp.EmailBackend()
+ backend.connection = True
+ self.assertEqual(backend.send_messages([]), 0)
def test_send_messages_zero_sent(self):
"""A message isn't sent if it doesn't have any recipients."""