Refactor imports and remove unused code in test_security.py
Cleaned up unused imports including `timezone` and `ExpiredSignatureError`. Streamlined the import structure to improve readability and maintainability. These changes do not affect functionality but enhance code clarity.
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
|
from datetime import timedelta, datetime
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from datetime import timedelta, datetime, timezone
|
from jose import jwt, JWTError
|
||||||
from jose import jwt, JWTError, ExpiredSignatureError
|
|
||||||
from app.auth.security import (
|
from app.auth.security import (
|
||||||
get_password_hash, verify_password,
|
get_password_hash, verify_password,
|
||||||
create_access_token, create_refresh_token,
|
create_access_token, create_refresh_token,
|
||||||
@@ -69,7 +71,6 @@ def test_decode_token_missing_exp():
|
|||||||
assert str(exc_info.value) == "Malformed token. Missing required claim."
|
assert str(exc_info.value) == "Malformed token. Missing required claim."
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_decode_token_missing_sub():
|
def test_decode_token_missing_sub():
|
||||||
# Create a token without the `sub` claim
|
# Create a token without the `sub` claim
|
||||||
payload = {"exp": datetime.now().timestamp() + 60, "type": "access"}
|
payload = {"exp": datetime.now().timestamp() + 60, "type": "access"}
|
||||||
|
|||||||
Reference in New Issue
Block a user