You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
501 B
Python
15 lines
501 B
Python
# backend/tests/test_crypto.py — C6 토큰 암복호화 왕복
|
|
from app.crypto import decrypt_token, encrypt_token
|
|
|
|
|
|
def test_roundtrip():
|
|
tok = {"access_token": "AT", "refresh_token": "RT", "expires_at": 123456}
|
|
enc = encrypt_token(tok)
|
|
assert "AT" not in enc # 평문 노출 금지
|
|
assert decrypt_token(enc) == tok
|
|
|
|
|
|
def test_empty_and_corrupt_safe():
|
|
assert decrypt_token("") == {}
|
|
assert decrypt_token("not-a-valid-fernet-token") == {} # 예외 누수 없이 {} 폴백
|