from app.security import entry_key_hash, hash_password, validate_password, verify_password def test_password_hash_round_trip(): encoded = hash_password("StrongPass123") assert "StrongPass123" not in encoded assert verify_password("StrongPass123", encoded) assert not verify_password("wrong", encoded) def test_password_policy(): assert validate_password("short") assert validate_password("onlyletterslong") assert validate_password("StrongPass123") is None def test_entry_key_hash_is_deterministic_without_storing_plaintext(): first = entry_key_hash("1234") assert first == entry_key_hash("1234") assert first != entry_key_hash("4321") assert "1234" not in first