Skip to content

Commit

Permalink
Django 4.1 5.0 (#126)
Browse files Browse the repository at this point in the history
* Add tests for newer django-versions

* Downgrade checkout and setup-python

* Revert "Downgrade checkout and setup-python"

This reverts commit dd41222.

* Python < 3.7 not available for arch x64

* Handle python < 3.8

* Use PBKDF2PasswordHasher in tests

* Update django version in docs

* Make hasher used in tests explicit

* Cover python 3.7 in tox

* Add to changelog
  • Loading branch information
bgaudino authored Mar 19, 2024
1 parent cc21028 commit d6c50cb
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 41 deletions.
72 changes: 44 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,62 +9,78 @@ jobs:
matrix:
include:
# Django 2.2
- django-version: "2.2.0"
python-version: "3.5"
- django-version: "2.2.0"
python-version: "3.6"
- django-version: "2.2.0"
- django-version: "2.2"
python-version: "3.7"
- django-version: "2.2.0"
- django-version: "2.2"
python-version: "3.8"
- django-version: "2.2.0"
- django-version: "2.2"
python-version: "3.9"

# Django 3.0
- django-version: "3.0.0"
python-version: "3.6"
- django-version: "3.0.0"
- django-version: "3.0"
python-version: "3.7"
- django-version: "3.0.0"
- django-version: "3.0"
python-version: "3.8"
- django-version: "3.0.0"
- django-version: "3.0"
python-version: "3.9"

# Django 3.1
- django-version: "3.1.0"
python-version: "3.6"
- django-version: "3.1.0"
- django-version: "3.1"
python-version: "3.7"
- django-version: "3.1.0"
- django-version: "3.1"
python-version: "3.8"
- django-version: "3.1.0"
- django-version: "3.1"
python-version: "3.9"

# Django 3.2
- django-version: "3.2.0"
python-version: "3.6"
- django-version: "3.2.0"
- django-version: "3.2"
python-version: "3.7"
- django-version: "3.2.0"
- django-version: "3.2"
python-version: "3.8"
- django-version: "3.2.0"
- django-version: "3.2"
python-version: "3.9"
- django-version: "3.2.0"
- django-version: "3.2"
python-version: "3.10"

# Django 4.0
- django-version: "4.0.0"
- django-version: "4.0"
python-version: "3.8"
- django-version: "4.0.0"
- django-version: "4.0"
python-version: "3.9"
- django-version: "4.0.0"
- django-version: "4.0"
python-version: "3.10"

# Django 4.1
- django-version: "4.1"
python-version: "3.8"
- django-version: "4.1"
python-version: "3.9"
- django-version: "4.1"
python-version: "3.10"

# Django 4.2
- django-version: "4.2"
python-version: "3.8"
- django-version: "4.2"
python-version: "3.9"
- django-version: "4.2"
python-version: "3.10"
- django-version: "4.2"
python-version: "3.11"

# Django 5.0
- django-version: "5.0"
python-version: "3.10"
- django-version: "5.0"
python-version: "3.11"
- django-version: "5.0"
python-version: "3.12"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
6 changes: 5 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ CHANGES
2.0.1 (unreleased)
------------------

- Nothing changed yet.
- Resolve `SHA1PasswordHasher` deprecation warning for Django 4.0 and above
- Resolve `pkg_resources` deprecation warning for Python 3.8 and above
- Add test coverage for Django 4.1, 4.2, and 5.0
- Add test coverage for Python 3.11 and 3.12
- Python 3.5 and 3.6 are no longer availble in GitHub runner using `ubuntu-latest`


2.0.0 (2022-07-29)
Expand Down
9 changes: 7 additions & 2 deletions authtools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import pkg_resources
try:
from importlib.metadata import version

__version__ = pkg_resources.get_distribution('django-authtools').version
__version__ = version('django-authtools')
except ImportError:
import pkg_resources

__version__ = pkg_resources.get_distribution('django-authtools').version
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
django-authtools
================

A custom user model app for Django 1.5+. It tries to stay true to the built-in
A custom user model app for Django 2.2+. It tries to stay true to the built-in
User model for the most part. The main differences between authtools and
django.contrib.auth are a User model with email as username.

Expand Down
5 changes: 0 additions & 5 deletions tests/tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,8 @@
},
]

# sha1 hasher was removed as a default in django 1.10. Need it for the tests.
PASSWORD_HASHERS = [
'django.contrib.auth.hashers.SHA1PasswordHasher',
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
'django.contrib.auth.hashers.BCryptPasswordHasher',
]

USE_TZ = False
6 changes: 3 additions & 3 deletions tests/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ def test_uses_auth_password_validators(self):


@skipIfCustomUser
@override_settings(USE_TZ=False, PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
@override_settings(USE_TZ=False)
class UserChangeFormTest(TestCase):
@classmethod
def setUpTestData(cls):
cls.u1 = User.objects.create(
password='sha1$6efc0$f93efe9fd7542f25a7be94871ea45aa95de57161',
password='pbkdf2_sha256$600000$U3$rhq9d758wGq/JU5/+bkG8OqDVY05d04zKD4cuamR+Sk=',
last_login=datetime.datetime(2006, 12, 17, 7, 3, 31), is_superuser=False, username='testclient',
first_name='Test', last_name='Client', email='[email protected]', is_staff=False, is_active=True,
date_joined=datetime.datetime(2006, 12, 17, 7, 3, 31)
Expand Down Expand Up @@ -242,7 +242,7 @@ def test_bug_19133(self):
form = UserChangeForm(instance=user, data=post_data)

self.assertTrue(form.is_valid())
self.assertEqual(form.cleaned_data['password'], 'sha1$6efc0$f93efe9fd7542f25a7be94871ea45aa95de57161')
self.assertEqual(form.cleaned_data['password'], 'pbkdf2_sha256$600000$U3$rhq9d758wGq/JU5/+bkG8OqDVY05d04zKD4cuamR+Sk=')

def test_bug_19349_bound_password_field(self):
user = User.objects.get(username='testclient')
Expand Down
13 changes: 12 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
[tox]
envlist=
py39-dj{22,30,31,32,40}
py37-dj{22,30,32,32}
py{38,39}-dj{22,30,31,32,40,41,42}
py{10}-dj{32,40,41,42,50}
py{11,12}-dj{42,50}
[testenv]
python=
py37: python3.7
py38: python3.8
py39: python3.9
py310: python3.10
py311: python3.11
py312: python3.12
commands=
/usr/bin/env
make test
Expand All @@ -13,6 +21,9 @@ deps=
dj31: Django>=3.1,<3.2
dj32: Django>=3.2,<3.3
dj40: Django>=4.0,<4.1
dj41: Django>=4.1,<4.2
dj42: Django>=4.2,<4.3
dj50: Django>=5.0,<5.1
whitelist_externals=
env
make

0 comments on commit d6c50cb

Please sign in to comment.