Files
plm-lottery/tests/unit/test_security.py
T
davideandClaude Sonnet 5 107e592704 Add authentication and user profile endpoint
Argon2 password hashing, JWT session issuing/verification
(auth/security.py), register/login routes, the bearer-token
get_current_user dependency, and GET /users/me for address + balance.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-21 10:25:49 +02:00

14 lines
444 B
Python

from app.auth import security
def test_password_hash_roundtrip():
hashed = security.hash_password("s3cret!")
assert security.verify_password("s3cret!", hashed)
assert not security.verify_password("wrong", hashed)
def test_jwt_roundtrip(monkeypatch):
monkeypatch.setattr(security.settings, "jwt_secret", "test-secret")
token = security.create_access_token(user_id=42)
assert security.decode_access_token(token) == 42