first commit
This commit is contained in:
BIN
tests/__pycache__/test_algorithms.cpython-312-pytest-9.0.1.pyc
Normal file
BIN
tests/__pycache__/test_algorithms.cpython-312-pytest-9.0.1.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -9,3 +9,33 @@ def test_main_verify_round_trip() -> None:
|
||||
salt, hashed = hash_password("secret-value")
|
||||
assert main(["verify", "secret-value", salt, hashed]) == 0
|
||||
assert main(["verify", "wrong", salt, hashed]) == 1
|
||||
|
||||
|
||||
def test_main_hash_with_algorithm_pbkdf2() -> None:
|
||||
"""Test hash command with --algorithm pbkdf2."""
|
||||
assert main(["hash", "--algorithm", "pbkdf2", "test-password"]) == 0
|
||||
|
||||
|
||||
def test_main_hash_with_algorithm_argon2() -> None:
|
||||
"""Test hash command with --algorithm argon2."""
|
||||
assert main(["hash", "--algorithm", "argon2", "test-password"]) == 0
|
||||
|
||||
|
||||
def test_main_hash_with_algorithm_bcrypt() -> None:
|
||||
"""Test hash command with --algorithm bcrypt."""
|
||||
assert main(["hash", "--algorithm", "bcrypt", "test-password"]) == 0
|
||||
|
||||
|
||||
def test_main_verify_with_algorithm() -> None:
|
||||
"""Test verify command with --algorithm option."""
|
||||
# Test with each algorithm
|
||||
for algo in ["pbkdf2", "argon2", "bcrypt"]:
|
||||
salt, hashed = hash_password("test-pw", algorithm=algo)
|
||||
assert main(["verify", "--algorithm", algo, "test-pw", salt, hashed]) == 0
|
||||
assert main(["verify", "--algorithm", algo, "wrong", salt, hashed]) == 1
|
||||
|
||||
|
||||
def test_main_hash_algorithm_shortcut() -> None:
|
||||
"""Test shortcut syntax with --algorithm option."""
|
||||
# Should support: python3 salt.py --algorithm argon2 mypassword
|
||||
assert main(["--algorithm", "argon2", "test-password"]) == 0
|
||||
|
||||
Reference in New Issue
Block a user