-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ronny Vedrilla
committed
Oct 31, 2023
1 parent
7ad1945
commit c26b7ba
Showing
8 changed files
with
86 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
from unittest import mock | ||
|
||
from django.core.mail import EmailMultiAlternatives | ||
from django.core.mail.backends.smtp import EmailBackend | ||
from django.test import TestCase, override_settings | ||
|
||
from ambient_toolbox.mail.backends.whitelist_smtp import WhitelistEmailBackend | ||
|
@@ -42,3 +45,18 @@ def test_process_recipients_regular(self): | |
message_list = backend._process_recipients([mail]) | ||
self.assertEqual(len(message_list), 1) | ||
self.assertEqual(message_list[0].to, ['[email protected]']) | ||
|
||
@mock.patch.object(EmailBackend, "send_messages") | ||
@mock.patch.object(WhitelistEmailBackend, "_process_recipients") | ||
def test_send_messages_process_recipients_called(self, mocked_process_recipients, *args): | ||
backend = WhitelistEmailBackend() | ||
backend.send_messages([]) | ||
|
||
mocked_process_recipients.assert_called_once_with([]) | ||
|
||
@mock.patch.object(EmailBackend, "send_messages") | ||
def test_send_messages_super_called(self, mocked_send_messages): | ||
backend = WhitelistEmailBackend() | ||
backend.send_messages([]) | ||
|
||
mocked_send_messages.assert_called_once_with([]) |