1
0

- Add upstream patch fix-tests.patch to fix tests with Django 5

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:django/python-djangorestframework-simplejwt?expand=0&rev=5
This commit is contained in:
Markéta Machová 2024-07-19 11:27:54 +00:00 committed by Git OBS Bridge
commit 8763f99ae5
6 changed files with 237 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6c4bd37537440bc439564ebf7d6085e74c5411485197073f508ebdfa34bc9fae
size 94266

72
fix-tests.patch Normal file
View File

@ -0,0 +1,72 @@
From 0b50ee6721155ce0f652d4c1f47dcbb10c191894 Mon Sep 17 00:00:00 2001
From: Mike <mike@zivix.com>
Date: Mon, 4 Dec 2023 17:48:36 -0800
Subject: [PATCH] Fix tests (#769)
---
rest_framework_simplejwt/utils.py | 5 ++---
tests/test_init.py | 5 ++---
tests/test_utils.py | 11 ++++-------
3 files changed, 8 insertions(+), 13 deletions(-)
Index: djangorestframework_simplejwt-5.3.1/rest_framework_simplejwt/utils.py
===================================================================
--- djangorestframework_simplejwt-5.3.1.orig/rest_framework_simplejwt/utils.py
+++ djangorestframework_simplejwt-5.3.1/rest_framework_simplejwt/utils.py
@@ -5,7 +5,6 @@ from typing import Callable
from django.conf import settings
from django.utils.functional import lazy
-from django.utils.timezone import is_naive, make_aware
def get_md5_hash_password(password: str) -> str:
@@ -16,8 +15,8 @@ def get_md5_hash_password(password: str)
def make_utc(dt: datetime) -> datetime:
- if settings.USE_TZ and is_naive(dt):
- return make_aware(dt, timezone=timezone.utc)
+ if settings.USE_TZ and dt.tzinfo is None:
+ return dt.replace(tzinfo=timezone.utc)
return dt
Index: djangorestframework_simplejwt-5.3.1/tests/test_utils.py
===================================================================
--- djangorestframework_simplejwt-5.3.1.orig/tests/test_utils.py
+++ djangorestframework_simplejwt-5.3.1/tests/test_utils.py
@@ -1,7 +1,6 @@
-from datetime import datetime, timedelta
+from datetime import datetime, timedelta, timezone
from django.test import TestCase
-from django.utils import timezone
from freezegun import freeze_time
from rest_framework_simplejwt.utils import (
@@ -24,11 +23,11 @@ class TestMakeUtc(TestCase):
with self.settings(USE_TZ=False):
dt = make_utc(dt)
- self.assertTrue(timezone.is_naive(dt))
+ self.assertTrue(dt.tzinfo is None)
with self.settings(USE_TZ=True):
dt = make_utc(dt)
- self.assertTrue(timezone.is_aware(dt))
+ self.assertTrue(dt.tzinfo is not None)
self.assertEqual(dt.utcoffset(), timedelta(seconds=0))
@@ -39,9 +38,7 @@ class TestAwareUtcnow(TestCase):
with freeze_time(now):
# Should return aware utcnow if USE_TZ == True
with self.settings(USE_TZ=True):
- self.assertEqual(
- timezone.make_aware(now, timezone=timezone.utc), aware_utcnow()
- )
+ self.assertEqual(now.replace(tzinfo=timezone.utc), aware_utcnow())
# Should return naive utcnow if USE_TZ == False
with self.settings(USE_TZ=False):

View File

@ -0,0 +1,67 @@
-------------------------------------------------------------------
Fri Jul 19 11:26:13 UTC 2024 - Markéta Machová <mmachova@suse.com>
- Add upstream patch fix-tests.patch to fix tests with Django 5
-------------------------------------------------------------------
Mon Jun 24 04:49:38 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Switch back to PyPi tarball.
- Inject setuptools_scm so we install the correct version number.
- Switch to autosetup macro.
- No more greedy globs in %files.
-------------------------------------------------------------------
Tue Jun 18 14:02:32 UTC 2024 - Markéta Machová <mmachova@suse.com>
- Update to 5.3.1
* Breaking: Set BLACKLIST_AFTER_ROTATION by default to False
* Remove EOL Python, Django and DRF version support
* Remove verify from jwt.decode to follow PyJWT v2.2.0
* Add blacklist view to log out users
* Add JWKS support
* Add back support for PyJWT 1.7.1
* Allow customizing token JSON encoding
* Revoke access token if user password is changed
* Declare support for type checking
* Many more changes, see CHANGELOG.md
- Drop patch jwt2.patch, included upstream.
-------------------------------------------------------------------
Wed Mar 27 05:20:10 UTC 2024 - Max Lin <mlin@suse.com>
- Add %{?sle15_python_module_pythons}
-------------------------------------------------------------------
Wed Mar 31 14:25:07 UTC 2021 - Markéta Machová <mmachova@suse.com>
- Update to 4.6.0
* Restored Python 3.7 support
* Added Indonesian translations
* Fixed Django 4.0 re_path deprecation
- Add patch jwt2.patch for PyJWT>=2.0.0 support
-------------------------------------------------------------------
Fri Jul 24 07:55:24 UTC 2020 - John Vandenberg <jayvdb@gmail.com>
- Update to v4.4.0
* Added official support for Python 3.8 and Django 3.0.
* Added settings for expected audience and issuer claims.
* Documentation updates.
* Updated package/python version support
* Added Chilean Spanish language support.
* Added Russian language support.
-------------------------------------------------------------------
Fri Sep 13 08:46:31 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 4.3.0:
* Added JTI_CLAIM setting to allow storing token identifiers under a different claim.
* We now return HTTP 401 for user not found or inactive.
* Restricted setup.py config to Python 3 only.
* Included translation files in release package.
-------------------------------------------------------------------
Tue Apr 9 02:39:36 PM UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Initial spec for v4.1.3

View File

@ -0,0 +1,71 @@
#
# spec file for package python-djangorestframework-simplejwt
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?sle15_python_module_pythons}
Name: python-djangorestframework-simplejwt
Version: 5.3.1
Release: 0
Summary: JSON Web Token authentication for Django REST Framework
License: MIT
URL: https://github.com/davesque/django-rest-framework-simplejwt
Source: https://files.pythonhosted.org/packages/source/d/djangorestframework-simplejwt/djangorestframework_simplejwt-%{version}.tar.gz
# PATCH-FIX-UPSTREAM https://github.com/jazzband/djangorestframework-simplejwt/pull/769 Fix tests
Patch0: fix-tests.patch
BuildRequires: %{python_module Django}
BuildRequires: %{python_module PyJWT}
BuildRequires: %{python_module djangorestframework}
BuildRequires: %{python_module freezegun}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest-django}
BuildRequires: %{python_module python-jose}
BuildRequires: %{python_module setuptools_scm}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-PyJWT
Requires: python-djangorestframework
Recommends: python-python-jose
BuildArch: noarch
%python_subpackages
%description
A minimal JSON Web Token authentication plugin for the Django REST Framework.
%prep
%autosetup -p1 -n djangorestframework_simplejwt-%{version}
%build
export LANG=en_US.UTF-8
%pyproject_wheel
%install
export LANG=en_US.UTF-8
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
export LANG=en_US.UTF-8
%pytest
%files %{python_files}
%license LICENSE.txt licenses/*
%doc README.rst CHANGELOG.md
%{python_sitelib}/rest_framework_simplejwt
%{python_sitelib}/djangorestframework_simplejwt-%{version}.dist-info
%changelog