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"
