Refactor public API around environments
This commit is contained in:
parent
57dae52cc2
commit
5d5243df23
41 changed files with 1301 additions and 459 deletions
|
|
@ -23,7 +23,7 @@ def test_cli_run_prints_json(
|
|||
def parse_args(self) -> argparse.Namespace:
|
||||
return argparse.Namespace(
|
||||
command="run",
|
||||
profile="debian-git",
|
||||
environment="debian:12",
|
||||
vcpu_count=1,
|
||||
mem_mib=512,
|
||||
timeout_seconds=30,
|
||||
|
|
@ -84,6 +84,24 @@ def test_cli_demo_ollama_prints_summary(
|
|||
assert "[summary] exit_code=0 fallback_used=False execution_mode=guest_vsock" in output
|
||||
|
||||
|
||||
def test_cli_env_list_prints_json(
|
||||
monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str]
|
||||
) -> None:
|
||||
class StubPyro:
|
||||
def list_environments(self) -> list[dict[str, object]]:
|
||||
return [{"name": "debian:12", "installed": False}]
|
||||
|
||||
class StubParser:
|
||||
def parse_args(self) -> argparse.Namespace:
|
||||
return argparse.Namespace(command="env", env_command="list")
|
||||
|
||||
monkeypatch.setattr(cli, "_build_parser", lambda: StubParser())
|
||||
monkeypatch.setattr(cli, "Pyro", StubPyro)
|
||||
cli.main()
|
||||
output = json.loads(capsys.readouterr().out)
|
||||
assert output["environments"][0]["name"] == "debian:12"
|
||||
|
||||
|
||||
def test_cli_requires_run_command() -> None:
|
||||
with pytest.raises(ValueError, match="command is required"):
|
||||
cli._require_command([])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue