From a98cc57f0a4f209e1134b422650bb5d0ec923ce8 Mon Sep 17 00:00:00 2001 From: Flosckow <66554425+Flosckow@users.noreply.github.com> Date: Wed, 24 May 2023 12:55:38 +0700 Subject: [PATCH] Add refresh token to schemas (#94) * Feat: add refresh token to schemas * Fix: add coverage --------- Co-authored-by: Daniil Dumchenko --- fastapi_keycloak/model.py | 2 + tests/coverage.xml | 473 ++++++++++++++++++++++++++++++++++++++ tests/test_functional.py | 7 +- 3 files changed, 479 insertions(+), 3 deletions(-) diff --git a/fastapi_keycloak/model.py b/fastapi_keycloak/model.py index 67289a4..9806baa 100644 --- a/fastapi_keycloak/model.py +++ b/fastapi_keycloak/model.py @@ -206,9 +206,11 @@ class KeycloakToken(BaseModel): Attributes: access_token (str): An access token + refresh_token (str): An a refresh token, default None """ access_token: str + refresh_token: Optional[str] = None def __str__(self): """String representation of KeycloakToken""" diff --git a/tests/coverage.xml b/tests/coverage.xml index e69de29..8db991e 100644 --- a/tests/coverage.xml +++ b/tests/coverage.xml @@ -0,0 +1,473 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_functional.py b/tests/test_functional.py index c3b2e8c..fa285f5 100644 --- a/tests/test_functional.py +++ b/tests/test_functional.py @@ -426,9 +426,10 @@ def test_user_groups(self, idp, user): ) def test_login_exceptions(self, idp, action, exception, user): - # Get access tokens for the users - access_token = idp.user_login(username=user.username, password=TEST_PASSWORD) - assert access_token + # Get access and refresh for the users + tokens = idp.user_login(username=user.username, password=TEST_PASSWORD) + assert tokens.access_token + assert tokens.refresh_token user.requiredActions.append(action) # Add an action user: KeycloakUser = idp.update_user(user=user) # Save the change