File size: 832 Bytes
977ccde
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""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