-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from deployed/django_4_support
Add support for django 4
- Loading branch information
Showing
7 changed files
with
127 additions
and
6 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
|
||
name: Test | ||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python: ['3.8', '3.9', '3.10', '3.11', '3.12'] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Install dependencies | ||
run: python -m pip install --upgrade pip tox tox-gh-actions | ||
|
||
- name: Run tests | ||
run: tox |
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 |
---|---|---|
|
@@ -93,7 +93,9 @@ def test_send_with_attachments(self): | |
recipients = ["[email protected]"] | ||
sent = self.mass_email_message.send(recipients) | ||
self.assertTrue(sent) | ||
self.assertEqual( | ||
mail.outbox[0].attachments, | ||
[("example_file.txt", "Some content of example file.", "text/plain")], | ||
) | ||
attachments = mail.outbox[0].attachments | ||
self.assertEqual(len(attachments), 1) | ||
self.assertTrue(attachments[0][0].startswith("example_file")) | ||
self.assertTrue(attachments[0][0].endswith(".txt")) | ||
self.assertEqual(attachments[0][1], "Some content of example file.") | ||
self.assertEqual(attachments[0][2], "text/plain") |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import sys | ||
|
||
import django | ||
from django.conf import settings | ||
from django.test.utils import get_runner | ||
|
||
if __name__ == "__main__": | ||
settings.configure() | ||
settings.SECRET_KEY = "secret-key" | ||
settings.INSTALLED_APPS = ( | ||
"django.contrib.auth", | ||
"django.contrib.contenttypes", | ||
"django.contrib.sessions", | ||
"django.contrib.admin", | ||
"django.contrib.messages", | ||
"emailtemplates", | ||
) | ||
settings.MIDDLEWARE = ( | ||
"django.contrib.auth.middleware.AuthenticationMiddleware", | ||
"django.contrib.sessions.middleware.SessionMiddleware", | ||
"django.contrib.messages.middleware.MessageMiddleware", | ||
) | ||
settings.DATABASES = { | ||
"default": { | ||
"ENGINE": "django.db.backends.sqlite3", | ||
"NAME": ":memory:", | ||
} | ||
} | ||
settings.TEMPLATES = [ | ||
{ | ||
"BACKEND": "django.template.backends.django.DjangoTemplates", | ||
"OPTIONS": { | ||
"context_processors": [ | ||
"django.contrib.auth.context_processors.auth", | ||
"django.contrib.messages.context_processors.messages", | ||
], | ||
}, | ||
} | ||
] | ||
django.setup() | ||
TestRunner = get_runner(settings) | ||
test_runner = TestRunner(verbosity=3) | ||
failures = test_runner.run_tests(["emailtemplates"]) | ||
sys.exit(bool(failures)) |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[tox] | ||
envlist = | ||
py{38,39}-django32 | ||
py{310,311,312}-django{40,41,42,50,51} | ||
|
||
[testenv] | ||
setenv = | ||
PYTHONPATH = {toxinidir} | ||
commands = | ||
coverage run {toxinidir}/runtests.py | ||
coverage report -m | ||
deps = | ||
packaging | ||
coverage | ||
mock | ||
django32: Django>=3.2,<3.3 | ||
django40: Django>=4.0,<4.1 | ||
django41: Django>=4.1,<4.2 | ||
django42: Django>=4.2,<5.0 | ||
django50: Django>=5.0,<5.1 | ||
django51: Django>=5.1,<5.2 | ||
|
||
[gh-actions] | ||
python = | ||
3.8: py38 | ||
3.9: py39 | ||
3.10: py310 | ||
3.11: py311 | ||
3.12: py312 |