1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Added test for the sendtestemail command when no recipients are given.

This commit is contained in:
Baptiste Mispelon 2024-01-24 19:02:42 +01:00 committed by GitHub
parent e412d85b46
commit a702a0773d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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