Skip to content

Commit

Permalink
Improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
seallard committed Mar 8, 2024
1 parent 7e6aade commit 1f9fcaf
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/integration/services/test_authentication_service.py
Original file line number Diff line number Diff line change
@@ -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


Expand All @@ -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)
Expand Down

0 comments on commit 1f9fcaf

Please sign in to comment.