API - update tests config

This commit is contained in:
Sam 2023-10-04 10:39:31 +02:00
parent e75a7f3f9d
commit 5ee89bc15e
3 changed files with 6 additions and 6 deletions

View File

@ -97,8 +97,8 @@ class TestingConfig(BaseConfig):
SECRET_KEY = 'test key' # nosec SECRET_KEY = 'test key' # nosec
BCRYPT_LOG_ROUNDS = 4 BCRYPT_LOG_ROUNDS = 4
TOKEN_EXPIRATION_DAYS = 0 TOKEN_EXPIRATION_DAYS = 0
TOKEN_EXPIRATION_SECONDS = 3 TOKEN_EXPIRATION_SECONDS = 60
PASSWORD_TOKEN_EXPIRATION_SECONDS = 3 PASSWORD_TOKEN_EXPIRATION_SECONDS = 60
UI_URL = 'http://0.0.0.0:5000' UI_URL = 'http://0.0.0.0:5000'
SENDER_EMAIL = 'fittrackee@example.com' SENDER_EMAIL = 'fittrackee@example.com'
OAUTH2_TOKEN_EXPIRES_IN = { OAUTH2_TOKEN_EXPIRES_IN = {

View File

@ -2128,7 +2128,7 @@ class TestPasswordResetRequest(ApiTestCaseMixin):
'email': user_1.email, 'email': user_1.email,
}, },
{ {
'expiration_delay': '3 seconds', 'expiration_delay': 'a minute',
'username': user_1.username, 'username': user_1.username,
'password_reset_url': ( 'password_reset_url': (
f'http://0.0.0.0:5000/password-reset?token={token}' 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) token = get_user_token(user_1.id, password_reset=True)
client = app.test_client() client = app.test_client()
with freeze_time(now + timedelta(seconds=4)): with freeze_time(now + timedelta(seconds=61)):
response = client.post( response = client.post(
'/api/auth/password/update', '/api/auth/password/update',
data=json.dumps( data=json.dumps(
@ -2649,7 +2649,7 @@ class TestUserLogout(ApiTestCaseMixin):
client, auth_token = self.get_test_client_and_auth_token( client, auth_token = self.get_test_client_and_auth_token(
app, user_1.email app, user_1.email
) )
with freeze_time(now + timedelta(seconds=4)): with freeze_time(now + timedelta(seconds=61)):
response = client.post( response = client.post(
'/api/auth/logout', '/api/auth/logout',
headers=dict(Authorization=f'Bearer {auth_token}'), headers=dict(Authorization=f'Bearer {auth_token}'),

View File

@ -376,7 +376,7 @@ class TestUserModelToken:
) -> None: ) -> None:
auth_token = user_1.encode_auth_token(user_1.id) auth_token = user_1.encode_auth_token(user_1.id)
now = datetime.utcnow() now = datetime.utcnow()
with freeze_time(now + timedelta(seconds=4)): with freeze_time(now + timedelta(seconds=61)):
assert ( assert (
User.decode_auth_token(auth_token) User.decode_auth_token(auth_token)
== 'signature expired, please log in again' == 'signature expired, please log in again'