From 5ee89bc15e83fb1950a381b613273b2e261ebbbc Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 4 Oct 2023 10:39:31 +0200 Subject: [PATCH] API - update tests config --- fittrackee/config.py | 4 ++-- fittrackee/tests/users/test_auth_api.py | 6 +++--- fittrackee/tests/users/test_users_model.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fittrackee/config.py b/fittrackee/config.py index 1f70d123..e1479b54 100644 --- a/fittrackee/config.py +++ b/fittrackee/config.py @@ -97,8 +97,8 @@ class TestingConfig(BaseConfig): SECRET_KEY = 'test key' # nosec BCRYPT_LOG_ROUNDS = 4 TOKEN_EXPIRATION_DAYS = 0 - TOKEN_EXPIRATION_SECONDS = 3 - PASSWORD_TOKEN_EXPIRATION_SECONDS = 3 + TOKEN_EXPIRATION_SECONDS = 60 + PASSWORD_TOKEN_EXPIRATION_SECONDS = 60 UI_URL = 'http://0.0.0.0:5000' SENDER_EMAIL = 'fittrackee@example.com' OAUTH2_TOKEN_EXPIRES_IN = { diff --git a/fittrackee/tests/users/test_auth_api.py b/fittrackee/tests/users/test_auth_api.py index 8247444b..c26b1ea2 100644 --- a/fittrackee/tests/users/test_auth_api.py +++ b/fittrackee/tests/users/test_auth_api.py @@ -2128,7 +2128,7 @@ class TestPasswordResetRequest(ApiTestCaseMixin): 'email': user_1.email, }, { - 'expiration_delay': '3 seconds', + 'expiration_delay': 'a minute', 'username': user_1.username, 'password_reset_url': ( f'http://0.0.0.0:5000/password-reset?token={token}' @@ -2235,7 +2235,7 @@ class TestPasswordUpdate(ApiTestCaseMixin): token = get_user_token(user_1.id, password_reset=True) client = app.test_client() - with freeze_time(now + timedelta(seconds=4)): + with freeze_time(now + timedelta(seconds=61)): response = client.post( '/api/auth/password/update', data=json.dumps( @@ -2649,7 +2649,7 @@ class TestUserLogout(ApiTestCaseMixin): client, auth_token = self.get_test_client_and_auth_token( app, user_1.email ) - with freeze_time(now + timedelta(seconds=4)): + with freeze_time(now + timedelta(seconds=61)): response = client.post( '/api/auth/logout', headers=dict(Authorization=f'Bearer {auth_token}'), diff --git a/fittrackee/tests/users/test_users_model.py b/fittrackee/tests/users/test_users_model.py index 2ca2440e..c1e9ddfc 100644 --- a/fittrackee/tests/users/test_users_model.py +++ b/fittrackee/tests/users/test_users_model.py @@ -376,7 +376,7 @@ class TestUserModelToken: ) -> None: auth_token = user_1.encode_auth_token(user_1.id) now = datetime.utcnow() - with freeze_time(now + timedelta(seconds=4)): + with freeze_time(now + timedelta(seconds=61)): assert ( User.decode_auth_token(auth_token) == 'signature expired, please log in again'