From 1f9fcaf4c59e3367527806f0da4fd18d0a48b7a4 Mon Sep 17 00:00:00 2001 From: Sebastian Allard Date: Fri, 8 Mar 2024 14:19:38 +0100 Subject: [PATCH] Improve test --- .../services/test_authentication_service.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/integration/services/test_authentication_service.py b/tests/integration/services/test_authentication_service.py index 9aaf85df..05a9b174 100644 --- a/tests/integration/services/test_authentication_service.py +++ b/tests/integration/services/test_authentication_service.py @@ -1,6 +1,7 @@ from requests_mock import Mocker from trailblazer.services.authentication_service.authentication_service import AuthenticationService +from trailblazer.services.encryption_service.encryption_service import EncryptionService from trailblazer.store.models import User @@ -18,13 +19,17 @@ def test_exchange_code(authentication_service: AuthenticationService, user_email assert user.refresh_token -def test_refresh_access_token(authentication_service: AuthenticationService, user_email: str): +def test_refresh_access_token( + authentication_service: AuthenticationService, + encryption_service: EncryptionService, + user_email: str, +): # GIVEN an encrypted access token - refresh_token: str = authentication_service.encryption_service.encrypt("refresh_token") + encrypted_refresh_token: str = encryption_service.encrypt("refresh_token") # GIVEN an existing user with the refresh token user: User = authentication_service.store.get_user(user_email) - user.refresh_token = refresh_token + user.refresh_token = encrypted_refresh_token # WHEN refreshing the access token token: str = authentication_service.refresh_access_token(user.id)