fix rate-limit valid login bug and fix sessions of redis and psql in tests
This commit is contained in:
@@ -118,7 +118,8 @@ class TestAuth:
|
||||
|
||||
with allure.step("create fake refresh token"):
|
||||
|
||||
token=await jwt_service.create_refresh_token({"sub":str(uuid4())})
|
||||
refresh_token=await jwt_service.create_refresh_token({"sub":str(uuid4())})
|
||||
access_token=await jwt_service.create_access_token({"sub":str(uuid4)})
|
||||
|
||||
with allure.step("patching db call functions"):
|
||||
|
||||
@@ -126,7 +127,7 @@ class TestAuth:
|
||||
|
||||
with allure.step("test logout with fake data"):
|
||||
|
||||
status=await current_user_service.logout(token[0])
|
||||
status=await current_user_service.logout(refresh_token[0], access_token)
|
||||
assert status is True
|
||||
|
||||
@pytest.mark.parametrize("jti,db_result, expected_exception, expected_status",[
|
||||
@@ -148,11 +149,11 @@ class TestAuth:
|
||||
|
||||
with allure.step("create fake refresh token"):
|
||||
|
||||
token=await fake_create_refresh_token({"sub":str(uuid4()), "jti":jti, "token_type":"refresh", "exp":datetime.now(UTC)+timedelta(days=45)})
|
||||
|
||||
refresh_token=await fake_create_refresh_token({"sub":str(uuid4()), "jti":jti, "token_type":"refresh", "exp":datetime.now(UTC)+timedelta(days=45)})
|
||||
access_token=await fake_create_refresh_token({"sub":str(uuid4()), "jti":jti, "token_type":"refresh", "exp":datetime.now(UTC)+timedelta(minutes=30)})
|
||||
with allure.step("test logout with fake data"), pytest.raises(expected_exception) as exc_info:
|
||||
|
||||
await current_user_service.logout(token)
|
||||
await current_user_service.logout(refresh_token, access_token)
|
||||
|
||||
if expected_exception is HTTPException:
|
||||
assert exc_info.value.status_code==expected_status
|
||||
|
||||
Reference in New Issue
Block a user