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