forked from pool/python-Authlib
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Authlib?expand=0&rev=31
71 lines
2.6 KiB
Diff
71 lines
2.6 KiB
Diff
From d282c1afad676cf8ed3670e60fd43516fc9615de Mon Sep 17 00:00:00 2001
|
|
From: "Kai A. Hiller" <git@kaialexhiller.de>
|
|
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
|
|
|