clan-cli: Refactor the API to use the Flake object

This commit is contained in:
Qubasa
2025-05-07 13:12:43 +02:00
committed by Mic92
parent dd3bb314fd
commit 153da50d6f
22 changed files with 125 additions and 98 deletions

View File

@@ -1,4 +1,5 @@
import pytest
from clan_cli.flake import Flake
from clan_cli.inventory import load_inventory_json
from clan_cli.secrets.folders import sops_machines_folder
from clan_cli.tests import fixtures_flakes
@@ -24,7 +25,7 @@ def test_machine_subcommands(
]
)
inventory: dict = dict(load_inventory_json(str(test_flake_with_core.path)))
inventory: dict = dict(load_inventory_json(Flake(str(test_flake_with_core.path))))
assert "machine1" in inventory["machines"]
assert "service" not in inventory
@@ -40,7 +41,7 @@ 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)))
inventory_2: dict = dict(load_inventory_json(Flake(str(test_flake_with_core.path))))
assert "machine1" not in inventory_2["machines"]
assert "service" not in inventory_2

View File

@@ -86,7 +86,7 @@ def test_add_module_to_inventory(
}
}
set_inventory(inventory, base_path, "Add borgbackup service")
set_inventory(inventory, Flake(str(base_path)), "Add borgbackup service")
# cmd = ["facts", "generate", "--flake", str(test_flake_with_core.path), "machine1"]
cmd = [