2309e9f43a
Five-service streaming platform: auth, catalogue, streaming, ingest, thumbnailer. Includes React frontend served by nginx, NATS JetStream event bus, aiobotocore async S3, PyAV video metadata + thumbnail extraction, service-to-service JWT auth, and a full unit + e2e test suite.
23 lines
608 B
Python
23 lines
608 B
Python
from streamstack.auth.hasher import hash_password, verify_password
|
|
|
|
|
|
def test_hash_and_verify():
|
|
plain = "super-secret-password"
|
|
hashed = hash_password(plain)
|
|
assert hashed != plain
|
|
assert verify_password(plain, hashed)
|
|
|
|
|
|
def test_wrong_password_fails():
|
|
hashed = hash_password("correct")
|
|
assert not verify_password("wrong", hashed)
|
|
|
|
|
|
def test_different_hashes_for_same_password():
|
|
plain = "same-password"
|
|
hash1 = hash_password(plain)
|
|
hash2 = hash_password(plain)
|
|
assert hash1 != hash2
|
|
assert verify_password(plain, hash1)
|
|
assert verify_password(plain, hash2)
|