Update tests
All checks were successful
CI / test (push) Successful in 51s
CI / test (almalinux, docker.io/library/almalinux:9, python3.11) (push) Successful in 11m30s
CI / test (debian, docker.io/library/debian:13, python3) (push) Successful in 19m55s
Lint / test (push) Successful in 44s

This commit is contained in:
Miguel Jacq 2026-06-22 11:06:24 +10:00
parent a0914e1369
commit c7a6bfe979
Signed by: mig5
GPG key ID: 03906B4110AAD3B8
5 changed files with 212 additions and 0 deletions

View file

@ -73,6 +73,64 @@ def test_cli_manifest_subcommand_calls_manifest(monkeypatch, tmp_path):
assert called["target"] == "ansible"
def test_cli_force_unsafe_path_before_subcommand_reaches_guard(monkeypatch, tmp_path):
seen = {}
def fake_confirm(*, force: bool = False) -> None:
seen["force"] = force
def fake_manifest(_harvest_dir: str, _out_dir: str, **_kwargs):
return None
monkeypatch.setattr(cli, "_confirm_root_path_safety", fake_confirm)
monkeypatch.setattr(cli, "manifest", fake_manifest)
monkeypatch.setattr(
sys,
"argv",
[
"enroll",
"--assume-safe-path",
"manifest",
"--harvest",
str(tmp_path / "bundle"),
"--out",
str(tmp_path / "ansible"),
],
)
cli.main()
assert seen["force"] is True
def test_cli_force_unsafe_path_after_subcommand_reaches_guard(monkeypatch, tmp_path):
seen = {}
def fake_confirm(*, force: bool = False) -> None:
seen["force"] = force
def fake_manifest(_harvest_dir: str, _out_dir: str, **_kwargs):
return None
monkeypatch.setattr(cli, "_confirm_root_path_safety", fake_confirm)
monkeypatch.setattr(cli, "manifest", fake_manifest)
monkeypatch.setattr(
sys,
"argv",
[
"enroll",
"manifest",
"--assume-safe-path",
"--harvest",
str(tmp_path / "bundle"),
"--out",
str(tmp_path / "ansible"),
],
)
cli.main()
assert seen["force"] is True
def test_cli_manifest_target_puppet_is_forwarded(monkeypatch, tmp_path):
called = {}