Initial certificate system
This commit is contained in:
15
backend/tests/test_security.py
Normal file
15
backend/tests/test_security.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from app.core.security import create_access_token, decode_access_token, hash_password, verify_password
|
||||
|
||||
|
||||
def test_password_hash_roundtrip():
|
||||
password_hash = hash_password("Secret123!")
|
||||
assert verify_password("Secret123!", password_hash)
|
||||
assert not verify_password("wrong", password_hash)
|
||||
|
||||
|
||||
def test_access_token_roundtrip():
|
||||
token = create_access_token("7", "system_admin", expires_in=60)
|
||||
payload = decode_access_token(token)
|
||||
assert payload is not None
|
||||
assert payload["sub"] == "7"
|
||||
assert payload["role"] == "system_admin"
|
||||
Reference in New Issue
Block a user