from thoughtsync.security import hash_password, verify_password def test_password_roundtrip(): h = hash_password("correct horse battery staple") assert verify_password("correct horse battery staple", h) assert not verify_password("wrong password", h) def test_password_hash_is_salted(): # Same input hashes differently each time (random salt). assert hash_password("same-input") != hash_password("same-input") def test_verify_rejects_garbage_hash(): assert not verify_password("whatever", "not-a-bcrypt-hash")