-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
6 changed files
with
21 additions
and
4 deletions.
There are no files selected for viewing
File renamed without changes.
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
Empty file.
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from threading import Thread | ||
from unittest import mock | ||
|
||
from django.test import TestCase | ||
|
||
from django_pony_express.services.asynchronous.thread import ThreadEmailService | ||
|
||
|
||
class ThreadEmailServiceTest(TestCase): | ||
@mock.patch.object(Thread, "start") | ||
def test_process_regular(self, mocked_start): | ||
email = "[email protected]" | ||
subject = "Test email" | ||
service = ThreadEmailService(recipient_email_list=[email]) | ||
service.subject = subject | ||
service.template_name = "testapp/test_email.html" | ||
|
||
self.assertIsNone(service.process()) | ||
mocked_start.assert_called_once() |
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 |
---|---|---|
|
@@ -345,7 +345,7 @@ def test_send_and_log_email_failure_privacy_active(self, mock_logger, *args): | |
@mock.patch.object(EmailMultiAlternatives, "send", side_effect=Exception("Broken pony")) | ||
@mock.patch("django_pony_express.services.base.BaseEmailService._logger") | ||
@mock.patch("django_pony_express.services.base.PONY_LOG_RECIPIENTS", True) | ||
def test_send_and_log_success_privacy_inactive(self, mock_logger, *args): | ||
def test_send_and_log_failure_privacy_inactive(self, mock_logger, *args): | ||
service = BaseEmailService(recipient_email_list=["[email protected]"]) | ||
result = service._send_and_log_email( | ||
msg=EmailMultiAlternatives(subject="The Pony Express", to=["[email protected]"]) | ||
|