forked from ui/django-post_office
-
Notifications
You must be signed in to change notification settings - Fork 0
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
16 changed files
with
37 additions
and
45 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
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 |
---|---|---|
|
@@ -2,9 +2,9 @@ | |
import time | ||
from datetime import timedelta | ||
from multiprocessing.context import TimeoutError | ||
from unittest.mock import MagicMock, patch | ||
from unittest.mock import patch | ||
from zoneinfo import ZoneInfo | ||
|
||
import pytz | ||
from django.conf import settings | ||
from django.core import mail | ||
from django.core.exceptions import ValidationError | ||
|
@@ -412,6 +412,7 @@ def test_send_bulk_with_faulty_template(self): | |
email = Email.objects.get(id=email.id) | ||
self.assertEqual(email.status, STATUS.sent) | ||
|
||
@override_settings(USE_TZ=False) | ||
def test_retry_failed(self): | ||
self.assertEqual(get_retry_timedelta(), timezone.timedelta(minutes=15)) | ||
self.assertEqual(get_max_retries(), 2) | ||
|
@@ -460,12 +461,12 @@ def test_retry_failed(self): | |
|
||
@override_settings(USE_TZ=True) | ||
def test_expired(self): | ||
tzinfo = pytz.timezone('Asia/Jakarta') | ||
tzinfo = ZoneInfo('Asia/Jakarta') | ||
email = create('[email protected]', recipients=['[email protected]'], subject='subject', message='message', | ||
expires_at=timezone.datetime(2020, 5, 18, 9, 0, 1, tzinfo=tzinfo)) | ||
self.assertEqual(email.expires_at, timezone.datetime(2020, 5, 18, 9, 0, 1, tzinfo=tzinfo)) | ||
msg = email.prepare_email_message() | ||
self.assertEqual(msg.extra_headers['Expires'], 'Mon, 18 May 09:00:01 +0707') | ||
self.assertEqual(msg.extra_headers['Expires'], 'Mon, 18 May 09:00:01 +0700') | ||
|
||
# check that email is not sent after its expire_at date | ||
with patch('django.utils.timezone.now', side_effect=lambda: timezone.datetime(2020, 5, 18, 9, 0, 2, tzinfo=tzinfo)): | ||
|
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,3 @@ | ||
import django | ||
import json | ||
import os | ||
|
||
|
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