From 66b2daf2b50d2ad2f39cb3f4b7e74667ccab7a160b6bf026dc667535bd65fe27 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Thu, 31 Oct 2024 09:13:33 +0000 Subject: [PATCH] - add py313-tests.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Authlib?expand=0&rev=31 --- py313-tests.patch | 70 ++++++++++++++++++++++++++++++++++++++++++ python-Authlib.changes | 5 +++ python-Authlib.spec | 9 ++++-- 3 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 py313-tests.patch diff --git a/py313-tests.patch b/py313-tests.patch new file mode 100644 index 0000000..ed73bab --- /dev/null +++ b/py313-tests.patch @@ -0,0 +1,70 @@ +From d282c1afad676cf8ed3670e60fd43516fc9615de Mon Sep 17 00:00:00 2001 +From: "Kai A. Hiller" +Date: Sun, 20 Oct 2024 16:56:25 +0200 +Subject: [PATCH] tests: Dereference LocalProxy before serialization + +--- + .../test_oauth2/test_jwt_access_token.py | 30 +++++++++++++++---- + 1 file changed, 25 insertions(+), 5 deletions(-) + +diff --git a/tests/flask/test_oauth2/test_jwt_access_token.py b/tests/flask/test_oauth2/test_jwt_access_token.py +index f4b8cf99..20feb1bb 100644 +--- a/tests/flask/test_oauth2/test_jwt_access_token.py ++++ b/tests/flask/test_oauth2/test_jwt_access_token.py +@@ -49,31 +49,51 @@ def create_resource_protector(app, validator): + @require_oauth() + def protected(): + user = db.session.get(User, current_token['sub']) +- return jsonify(id=user.id, username=user.username, token=current_token) ++ return jsonify( ++ id=user.id, ++ username=user.username, ++ token=current_token._get_current_object(), ++ ) + + @app.route('/protected-by-scope') + @require_oauth('profile') + def protected_by_scope(): + user = db.session.get(User, current_token['sub']) +- return jsonify(id=user.id, username=user.username, token=current_token) ++ return jsonify( ++ id=user.id, ++ username=user.username, ++ token=current_token._get_current_object(), ++ ) + + @app.route('/protected-by-groups') + @require_oauth(groups=['admins']) + def protected_by_groups(): + user = db.session.get(User, current_token['sub']) +- return jsonify(id=user.id, username=user.username, token=current_token) ++ return jsonify( ++ id=user.id, ++ username=user.username, ++ token=current_token._get_current_object(), ++ ) + + @app.route('/protected-by-roles') + @require_oauth(roles=['student']) + def protected_by_roles(): + user = db.session.get(User, current_token['sub']) +- return jsonify(id=user.id, username=user.username, token=current_token) ++ return jsonify( ++ id=user.id, ++ username=user.username, ++ token=current_token._get_current_object(), ++ ) + + @app.route('/protected-by-entitlements') + @require_oauth(entitlements=['captain']) + def protected_by_entitlements(): + user = db.session.get(User, current_token['sub']) +- return jsonify(id=user.id, username=user.username, token=current_token) ++ return jsonify( ++ id=user.id, ++ username=user.username, ++ token=current_token._get_current_object(), ++ ) + + return require_oauth + diff --git a/python-Authlib.changes b/python-Authlib.changes index d9d7d5d..3c73c73 100644 --- a/python-Authlib.changes +++ b/python-Authlib.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Oct 31 09:13:27 UTC 2024 - Dirk Müller + +- add py313-tests.patch + ------------------------------------------------------------------- Sat Sep 28 20:03:15 UTC 2024 - Dirk Müller diff --git a/python-Authlib.spec b/python-Authlib.spec index b1e9af8..77121d2 100644 --- a/python-Authlib.spec +++ b/python-Authlib.spec @@ -25,7 +25,10 @@ Summary: Python library for building OAuth and OpenID Connect servers License: BSD-3-Clause URL: https://authlib.org/ Source: https://github.com/lepture/%{modname}/archive/refs/tags/v%{version}.tar.gz#/%{modname}-%{version}.tar.gz +Patch1: https://github.com/lepture/authlib/commit/d282c1afad676cf8ed3670e60fd43516fc9615de.patch#/py313-tests.patch +BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: python-rpm-macros # SECTION test requirements BuildRequires: %{python_module anyio} @@ -53,16 +56,16 @@ BuildArch: noarch A Python library for building OAuth and OpenID Connect servers. %prep -%setup -q -n %{modname}-%{version} +%autosetup -p1 -n %{modname}-%{version} # Remove the file containing the commercial license so licensedigger # doesn't complain about the dual license rm COMMERCIAL-LICENSE %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check