Skip to content

Commit

Permalink
feat: update for django-rest-knox 4.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ssaavedra committed May 18, 2023
1 parent cc2642c commit 8384a9b
Show file tree
Hide file tree
Showing 14 changed files with 534 additions and 151 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.9", "3.10"]
django-version: ["22lts", "32lts"]
django-version: ["32lts", "41", "42lts"]

steps:
- uses: actions/checkout@v2
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0 # optional, default is 1
- name: Run pytest with coverage
run: |
python -m pip install --upgrade pip poetry-dynamic-versioning poetry
poetry install
poetry run python -m pip install -r requirements/requirements-testing.txt
poetry run python -m pip install -r requirements/requirements-django42lts.txt
poetry run pytest --cov-report xml --cov
- name: Analyze with SonarCloud

# You can pin the exact commit or the version.
Expand Down
2 changes: 1 addition & 1 deletion jwt_knox/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def ensure_valid_auth_token(self, user, token: AuthToken):
if auth_token.expiry is not None and auth_token.expiry < timezone.now():
auth_token.delete()
continue
digest = hash_token(token, auth_token.salt)
digest = hash_token(token)
if digest == auth_token.digest:
return auth_token

Expand Down
591 changes: 473 additions & 118 deletions poetry.lock

Large diffs are not rendered by default.

29 changes: 15 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ documentation = "https://github.com/ssaavedra/drf-jwt-knox"
keywords = ["django", "jwt"]

classifiers = [
'Development Status :: 3 - Alpha',
'Development Status :: 4 - Beta',
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
Expand All @@ -29,18 +29,13 @@ packages = ["jwt_knox"]

# Requirements
[dependencies]
djangorestframework = "^3.13"
django-rest-knox = "^4.1.0"
PyJWT = "^2.3.0"
djangorestframework = "^3.14"
django-rest-knox = "^4.2.0"
PyJWT = "^2.7.0"

[optional-dependencies]
tests = [
'pytest-cov=^3.0.0',
'pytest=^6.2.5',
]

[build-system]
requires = ["setuptools~=58", "poetry-core>=1.0.0", "poetry-dynamic-versioning"]
requires = ["setuptools>=67.7.2", "poetry-core>=1.6.0", "poetry-dynamic-versioning"]
build-backend = "poetry.core.masonry.api"

[tool.setuptools_scm]
Expand All @@ -59,10 +54,16 @@ packages = [
version = "0.0.0"

[tool.poetry.dependencies]
djangorestframework = "^3.13"
django-rest-knox = "^4.1.0"
PyJWT = "^2.3.0"
python = "^3.6"
djangorestframework = "^3.14"
django-rest-knox = "^4.2.0"
PyJWT = "^2.7.0"
python = "^3.9"

[tool.poetry.group.dev.dependencies]
pytest = "^7.3.1"
pytest-django = "^4.5.2"
pytest-cov = "^4.0.0"
tox = "^4.5.1"

[tool.poetry-dynamic-versioning]
enable = true
Expand Down
1 change: 0 additions & 1 deletion requirements/requirements-django22lts.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements/requirements-django40.txt

This file was deleted.

1 change: 1 addition & 0 deletions requirements/requirements-django41.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Django~=4.1.9
1 change: 1 addition & 0 deletions requirements/requirements-django42lts.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Django~=4.2.1
4 changes: 2 additions & 2 deletions requirements/requirements-testing.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
flake8~=4.0
isort~=5.10.1
pep8~=1.7.1
pytest~=6.2.5
pytest~=7.3.1
pytest-django~=4.5.2
pytest-cov~=3.0.0
pytest-cov~=4.0.0
4 changes: 1 addition & 3 deletions runtests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#! /usr/bin/env python
from __future__ import print_function

#! /usr/bin/env python3
import os
import subprocess
import sys
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ sonar.organization = ssaavedra-github
sonar.sources=jwt_knox
sonar.host.url=https://sonarcloud.io
sonar.python.coverage.reportPaths=./coverage.xml

sonar.python.version=3.9,3.10,3.11
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def pytest_configure():
SITE_ID=1,
SECRET_KEY='not very secret in tests',
USE_I18N=True,
USE_L10N=True,
STATIC_URL='/static/',
ROOT_URLCONF='tests.urls',
TEMPLATES=[
Expand Down
34 changes: 26 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,41 @@
addopts=--tb=short

[tox]
isolated_build = true
envlist=
{py35,py36}-django20,
{py27,py35,py36}-django111lts
# {py37,py38}-django32lts
{py39,py310,py311}-django41
{py39,py310}-django42lts
py311-djangomaster

[testenv]
commands = ./runtests.py --fast {posargs} --coverage -rw
allowlist_externals =
./runtests.py
poetry

commands_pre =
poetry install --no-root --sync

commands = poetry run ./runtests.py --fast {posargs} --coverage -rw
setenv =
PYTHONDONTWRITEBYTECODE=1
PYTHONWARNINGS=once

deps =
django111lts: -rrequirements/requirements-django111lts.txt
django20: -rrequirements/requirements-django20.txt
django32lts: -rrequirements/requirements-django32lts.txt
django41: -rrequirements/requirements-django41.txt
django42lts: -rrequirements/requirements-django42lts.txt
djangomaster: https://github.com/django/django/archive/master.tar.gz
-rrequirements/requirements-testing.txt

basepython =
py36: python3.6
py35: python3.5
py27: python2.7
py37: python3.7
py38: python3.8
py39: python3.9
py310: python3.10
py311: python3.11

package = wheel
require_locked_deps = true
poetry_dep_groups =
dev

0 comments on commit 8384a9b

Please sign in to comment.