forked from ui/django-post_office
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ruff check and isort, cleanup templates and added version to the docs.
- Loading branch information
1 parent
97b8522
commit 38a24af
Showing
33 changed files
with
57 additions
and
284 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
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,2 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
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 @@ | ||
from django.shortcuts import render | ||
|
||
# Create your views here. |
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
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,6 +1,5 @@ | ||
import os | ||
|
||
import pathlib | ||
from datetime import timedelta | ||
from email.mime.image import MIMEImage | ||
|
||
import pytest | ||
|
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 |
---|---|---|
|
@@ -7,12 +7,12 @@ | |
from django.core.management import call_command | ||
from django.utils.timezone import now | ||
|
||
from sendmail.config import settings | ||
from sendmail.models.attachment import Attachment | ||
from sendmail.models.emailaddress import EmailAddress | ||
from sendmail.models.emailmodel import STATUS, EmailModel | ||
from sendmail.utils import set_recipients | ||
|
||
|
||
def call_sendmail(*args, **kwargs): | ||
return call_command('sendmail', *args, **kwargs) | ||
|
||
|
@@ -92,7 +92,7 @@ def test_send_queued_mail(): | |
@pytest.mark.django_db | ||
def test_send_batch(): | ||
with mock.patch('django.db.connection.close', return_value=None): | ||
queue = [EmailModel.objects.create(from_email='[email protected]', status=STATUS.queued, language='en') for _ in range(200)] | ||
_ = [EmailModel.objects.create(from_email='[email protected]', status=STATUS.queued, language='en') for _ in range(200)] | ||
|
||
call_sendmail('batch', processes=1) | ||
assert EmailModel.objects.filter(status=STATUS.sent).count() == 100 | ||
|
@@ -122,7 +122,7 @@ def test_failed_deliveries_logging(): | |
""" | ||
|
||
with mock.patch('django.db.connection.close', return_value=None): | ||
recipient = EmailAddress.objects.create(email=f'[email protected]') | ||
recipient = EmailAddress.objects.create(email='[email protected]') | ||
email = EmailModel.objects.create( | ||
from_email='[email protected]', status=STATUS.queued, backend_alias='error', language='en' | ||
) | ||
|
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,6 +1,5 @@ | ||
import time | ||
from datetime import timedelta | ||
from multiprocessing import Process | ||
|
||
import pytest | ||
|
||
|
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,24 +1,20 @@ | ||
import logging | ||
import tempfile | ||
from datetime import timedelta | ||
from unittest.mock import patch | ||
from zoneinfo import ZoneInfo | ||
|
||
import pytest | ||
from django.core.exceptions import ValidationError | ||
from django.db import connection | ||
from django.db.utils import InterfaceError | ||
from django.test.utils import CaptureQueriesContext | ||
from django.utils import timezone | ||
from django.core.files.base import ContentFile | ||
|
||
from sendmail.mail import _send_bulk, create_email, get_queued, send, send_many, split_into_batches | ||
from sendmail.models.attachment import Attachment | ||
from sendmail.models.emailaddress import EmailAddress, Recipient | ||
from sendmail.models.emailmerge import EmailMergeModel, PlaceholderContent | ||
from sendmail.models.emailmerge import EmailMergeModel | ||
from sendmail.models.emailmodel import PRIORITY, STATUS, EmailModel | ||
from sendmail.settings import get_available_backends | ||
|
||
#from django.conf import settings | ||
|
||
|
||
@pytest.fixture | ||
|
@@ -478,7 +474,6 @@ def test_get_queued(): | |
assert list(get_queued()) == [queued_email, past_email] | ||
|
||
|
||
from django.core import mail | ||
|
||
|
||
@pytest.mark.django_db | ||
|
@@ -572,7 +567,6 @@ def test_extra_recipients(template): | |
assert extra[1].address.email == '[email protected]' | ||
|
||
|
||
from django.core.files.base import ContentFile | ||
|
||
|
||
@pytest.fixture | ||
|
@@ -598,7 +592,7 @@ def template_with_extra_attachments(settings, template): | |
def test_extra_attachments(template_with_extra_attachments): | ||
# Retrieve the template with the extra attachments already set up | ||
template = template_with_extra_attachments | ||
en_translation = template.translated_contents.get(language='en') | ||
template.translated_contents.get(language='en') | ||
|
||
# No need to create the attachment again since the fixture already does that | ||
recipients = ['[email protected]', '[email protected]'] | ||
|
Oops, something went wrong.