23 lines
830 B
Python
23 lines
830 B
Python
"""Tests for extended_surface checks (cross-platform where possible)."""
|
|
|
|
from pathlib import Path
|
|
|
|
from applepy.checks.extended_surface import check_hosts_file, check_shell_startup_files
|
|
from applepy.context import RunContext
|
|
|
|
|
|
def test_check_hosts_file_returns_finding(tmp_path: Path) -> None:
|
|
ctx = RunContext(home=tmp_path, output_dir=tmp_path, phase="unprivileged")
|
|
out = check_hosts_file(ctx)
|
|
assert len(out) == 1
|
|
assert out[0].id == "ext-102"
|
|
assert out[0].worksheet == "Attack surface"
|
|
|
|
|
|
def test_check_shell_startup_lists_paths(tmp_path: Path) -> None:
|
|
ctx = RunContext(home=tmp_path, output_dir=tmp_path, phase="unprivileged")
|
|
out = check_shell_startup_files(ctx)
|
|
assert len(out) == 1
|
|
assert out[0].id == "ext-107"
|
|
assert ".zshrc" in out[0].evidence or "zshrc" in out[0].evidence
|