integration tests

This commit is contained in:
2026-07-30 15:49:08 +03:00
parent f87f54de55
commit 439d57554c
5 changed files with 130 additions and 40 deletions
+4
View File
@@ -34,6 +34,8 @@ class Jwt:
def create_access_token(self, data:dict)->str:
user_info=data.copy()
if not (user_info.get("sub")) or user_info.get("sub") == "":
raise self.error.credentials_error(detail="Jwt token is incorrect")
user_info.update({"exp": datetime.now(UTC)+timedelta(minutes=env_settings.ACCESS_TOKEN_EXPIRE_MINUTES),
"token_type":"access"})
return jwt.encode(user_info, env_settings.SECRET_KEY, env_settings.ALGORITHM)
@@ -43,6 +45,8 @@ class Jwt:
user_info=data.copy()
jti=str(uuid4())
if not (user_info.get("sub")) or user_info.get("sub") == "":
raise self.error.credentials_error(detail="Jwt token is incorrect")
user_info.update({"exp":datetime.now(UTC)+timedelta(days=env_settings.REFRESH_TOKEN_EXPIRE_DAYS),
"token_type":"refresh",
"jti":jti