Cli: delete machines bugfix. Dont modify the inventory in other places

This commit is contained in:
Johannes Kirschbauer
2025-02-10 17:16:50 +07:00
parent 2412513ad4
commit 153b5560c3
2 changed files with 12 additions and 14 deletions

View File

@@ -1,4 +1,5 @@
import pytest
from clan_cli.inventory import load_inventory_json
from fixtures_flakes import FlakeForTest
from helpers import cli
from stdout import CaptureOutput
@@ -21,6 +22,10 @@ def test_machine_subcommands(
]
)
inventory: dict = dict(load_inventory_json(str(test_flake_with_core.path)))
assert "machine1" in inventory["machines"]
assert "service" not in inventory
with capture_output as output:
cli.run(["machines", "list", "--flake", str(test_flake_with_core.path)])
@@ -33,6 +38,10 @@ def test_machine_subcommands(
["machines", "delete", "--flake", str(test_flake_with_core.path), "machine1"]
)
inventory_2: dict = dict(load_inventory_json(str(test_flake_with_core.path)))
assert "machine1" not in inventory_2["machines"]
assert "service" not in inventory_2
with capture_output as output:
cli.run(["machines", "list", "--flake", str(test_flake_with_core.path)])
assert "machine1" not in output.out