mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
26 lines
946 B
Python
26 lines
946 B
Python
from unittest.mock import patch
|
|
|
|
from sentry.testutils.cases import TestCase
|
|
from sentry.testutils.silo import control_silo_test
|
|
from sentry.utils.email import send_mail
|
|
|
|
|
|
@control_silo_test
|
|
class SendMail(TestCase):
|
|
@patch("django.core.mail.EmailMessage", autospec=True)
|
|
@patch("django.core.mail.get_connection", return_value="connection")
|
|
def test_send_mail_with_kwargs(self, get_connection, MockEmailMessage):
|
|
patch.object(MockEmailMessage.return_value, "send")
|
|
send_mail(
|
|
"subject", "my_message", "[email protected]", ["[email protected]"], reply_to=["[email protected]"]
|
|
)
|
|
MockEmailMessage.assert_called_once_with(
|
|
"subject",
|
|
"my_message",
|
|
"[email protected]",
|
|
["[email protected]"],
|
|
connection="connection",
|
|
reply_to=["[email protected]"],
|
|
)
|
|
MockEmailMessage.return_value.send.assert_called_once_with(fail_silently=False)
|