-
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.
Co-authored-by: sk-rama
- Loading branch information
Showing
4 changed files
with
26 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
"""Class-based emails including a test suite for Django""" | ||
|
||
__version__ = "2.4.3" | ||
__version__ = "2.5.0" |
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
from unittest import mock | ||
|
||
from django.conf import settings | ||
from django.core import mail | ||
from django.core.mail import EmailMultiAlternatives | ||
from django.test import TestCase, override_settings | ||
from django.utils import translation | ||
|
@@ -27,6 +28,22 @@ def test_init_recipient_and_context_are_initialised_empty(self): | |
self.assertEqual(service.recipient_email_list, []) | ||
self.assertEqual(service.context_data, {}) | ||
|
||
def test_init_connection_regular(self): | ||
connection = mail.get_connection() | ||
|
||
service = BaseEmailService(recipient_email_list=["[email protected]"], connection=connection) | ||
|
||
service.subject = "My subject" | ||
service.template_name = "testapp/test_email.html" | ||
|
||
result = service.process() | ||
self.assertIs(result, 1) | ||
|
||
# Assert email was "sent" | ||
self.assertGreater(len(mail.outbox), 0) | ||
self.assertEqual(mail.outbox[0].subject, "My subject") | ||
self.assertEqual(mail.outbox[0].to, ["[email protected]"]) | ||
|
||
def test_get_logger_logger_not_set(self): | ||
service = BaseEmailService() | ||
email_logger = service._get_logger() | ||
|