Files
password-security-python/tests/test_integration.py
2025-11-13 23:56:05 +00:00

52 lines
1.4 KiB
Python

"""Integration tests for multi-algorithm password hashing."""
import subprocess
import sys
def test_pbkdf2_cli_integration():
"""Test PBKDF2 end-to-end via CLI."""
result = subprocess.run(
[sys.executable, "salt.py", "hash", "--algorithm", "pbkdf2", "test123"],
capture_output=True,
text=True,
)
assert result.returncode == 0
assert "Salt:" in result.stdout
assert "Hash:" in result.stdout
def test_argon2_cli_integration():
"""Test Argon2 end-to-end via CLI."""
result = subprocess.run(
[sys.executable, "salt.py", "hash", "--algorithm", "argon2", "test123"],
capture_output=True,
text=True,
)
assert result.returncode == 0
assert "Hash:" in result.stdout
def test_bcrypt_cli_integration():
"""Test bcrypt end-to-end via CLI."""
result = subprocess.run(
[sys.executable, "salt.py", "hash", "--algorithm", "bcrypt", "test123"],
capture_output=True,
text=True,
)
assert result.returncode == 0
assert "Hash:" in result.stdout
def test_list_algorithms_integration():
"""Test list-algorithms command."""
result = subprocess.run(
[sys.executable, "salt.py", "list-algorithms"],
capture_output=True,
text=True,
)
assert result.returncode == 0
assert "argon2" in result.stdout
assert "bcrypt" in result.stdout
assert "pbkdf2" in result.stdout