HDK-audit / tests /test_cli.py
JakCwi's picture
Initial release: code, docs, tests (CC BY-NC 4.0)
977ccde
Raw History Blame Contribute Delete
832 Bytes
"""Tests for CLI."""
import os
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
ENV = {**os.environ, "PYTHONPATH": str(ROOT / "src")}
def test_cli_help():
"""--help returns 0 and contains 'verify'."""
result = subprocess.run(
[sys.executable, "-m", "hdk.cli", "--help"],
capture_output=True, text=True,
env=ENV, cwd=ROOT,
)
assert result.returncode == 0
assert "verify" in result.stdout
assert "hdk-audit" in result.stdout
def test_cli_version():
"""version command returns 0 and shows '0.1.3'."""
result = subprocess.run(
[sys.executable, "-m", "hdk.cli", "version"],
capture_output=True, text=True,
env=ENV, cwd=ROOT,
)
assert result.returncode == 0
assert "0.1.3" in result.stdout