summaryrefslogtreecommitdiff
path: root/tests/mail
diff options
context:
space:
mode:
authorBaptiste Mispelon <bmispelon@gmail.com>2024-01-24 19:02:42 +0100
committerGitHub <noreply@github.com>2024-01-24 15:02:42 -0300
commita702a0773dee8ea74119a8e0edf7ecc5d0ee4a1a (patch)
tree8392d9afe95e72a3e76fbebc496fd6e3abb92665 /tests/mail
parente412d85b4626bc56eb25206a40c3529162ce5dfc (diff)
Added test for the sendtestemail command when no recipients are given.
Diffstat (limited to 'tests/mail')
-rw-r--r--tests/mail/test_sendtestemail.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/mail/test_sendtestemail.py b/tests/mail/test_sendtestemail.py
index 8aff320568..c871f1a299 100644
--- a/tests/mail/test_sendtestemail.py
+++ b/tests/mail/test_sendtestemail.py
@@ -1,5 +1,5 @@
from django.core import mail
-from django.core.management import call_command
+from django.core.management import CommandError, call_command
from django.test import SimpleTestCase, override_settings
@@ -46,6 +46,18 @@ class SendTestEmailManagementCommand(SimpleTestCase):
],
)
+ def test_missing_receivers(self):
+ """
+ The command should complain if no receivers are given (and --admins or
+ --managers are not set).
+ """
+ msg = (
+ "You must specify some email recipients, or pass the --managers or "
+ "--admin options."
+ )
+ with self.assertRaisesMessage(CommandError, msg):
+ call_command("sendtestemail")
+
def test_manager_receivers(self):
"""
The mail should be sent to the email addresses specified in