11import time
22
3- import pytest
43from fastapi import status
54from freezegun import freeze_time
65from httpx import AsyncClient
1413from app .main import app
1514
1615
17- @pytest .mark .asyncio (loop_scope = "session" )
1816async def test_refresh_token_fails_with_message_when_token_does_not_exist (
1917 client : AsyncClient ,
2018) -> None :
@@ -29,7 +27,6 @@ async def test_refresh_token_fails_with_message_when_token_does_not_exist(
2927 assert response .json () == {"detail" : api_messages .REFRESH_TOKEN_NOT_FOUND }
3028
3129
32- @pytest .mark .asyncio (loop_scope = "session" )
3330async def test_refresh_token_fails_with_message_when_token_is_expired (
3431 client : AsyncClient ,
3532 default_user : User ,
@@ -54,7 +51,6 @@ async def test_refresh_token_fails_with_message_when_token_is_expired(
5451 assert response .json () == {"detail" : api_messages .REFRESH_TOKEN_EXPIRED }
5552
5653
57- @pytest .mark .asyncio (loop_scope = "session" )
5854async def test_refresh_token_fails_with_message_when_token_is_used (
5955 client : AsyncClient ,
6056 default_user : User ,
@@ -80,7 +76,6 @@ async def test_refresh_token_fails_with_message_when_token_is_used(
8076 assert response .json () == {"detail" : api_messages .REFRESH_TOKEN_ALREADY_USED }
8177
8278
83- @pytest .mark .asyncio (loop_scope = "session" )
8479async def test_refresh_token_success_response_status_code (
8580 client : AsyncClient ,
8681 default_user : User ,
@@ -105,7 +100,6 @@ async def test_refresh_token_success_response_status_code(
105100 assert response .status_code == status .HTTP_200_OK
106101
107102
108- @pytest .mark .asyncio (loop_scope = "session" )
109103async def test_refresh_token_success_old_token_is_used (
110104 client : AsyncClient ,
111105 default_user : User ,
@@ -134,7 +128,6 @@ async def test_refresh_token_success_old_token_is_used(
134128 assert used_test_refresh_token .used
135129
136130
137- @pytest .mark .asyncio (loop_scope = "session" )
138131async def test_refresh_token_success_jwt_has_valid_token_type (
139132 client : AsyncClient ,
140133 default_user : User ,
@@ -160,7 +153,6 @@ async def test_refresh_token_success_jwt_has_valid_token_type(
160153 assert token ["token_type" ] == "Bearer"
161154
162155
163- @pytest .mark .asyncio (loop_scope = "session" )
164156@freeze_time ("2023-01-01" )
165157async def test_refresh_token_success_jwt_has_valid_expire_time (
166158 client : AsyncClient ,
@@ -191,7 +183,6 @@ async def test_refresh_token_success_jwt_has_valid_expire_time(
191183 )
192184
193185
194- @pytest .mark .asyncio (loop_scope = "session" )
195186@freeze_time ("2023-01-01" )
196187async def test_refresh_token_success_jwt_has_valid_access_token (
197188 client : AsyncClient ,
@@ -223,7 +214,6 @@ async def test_refresh_token_success_jwt_has_valid_access_token(
223214 assert token_payload .exp == token ["expires_at" ]
224215
225216
226- @pytest .mark .asyncio (loop_scope = "session" )
227217@freeze_time ("2023-01-01" )
228218async def test_refresh_token_success_refresh_token_has_valid_expire_time (
229219 client : AsyncClient ,
@@ -254,7 +244,6 @@ async def test_refresh_token_success_refresh_token_has_valid_expire_time(
254244 )
255245
256246
257- @pytest .mark .asyncio (loop_scope = "session" )
258247async def test_refresh_token_success_new_refresh_token_is_in_db (
259248 client : AsyncClient ,
260249 default_user : User ,
0 commit comments