inventory.{cli,api}: use only dictionaries
This commit is contained in:
41
pkgs/clan-cli/tests/test_inventory.py
Normal file
41
pkgs/clan-cli/tests/test_inventory.py
Normal file
@@ -0,0 +1,41 @@
|
||||
from clan_cli.inventory.classes import Inventory, Machine, Meta, Service
|
||||
|
||||
|
||||
def test_make_meta_minimal() -> None:
|
||||
# Name is required
|
||||
res = Meta(
|
||||
{
|
||||
"name": "foo",
|
||||
}
|
||||
)
|
||||
|
||||
assert res == {"name": "foo"}
|
||||
|
||||
|
||||
def test_make_inventory_minimal() -> None:
|
||||
# Meta is required
|
||||
res = Inventory(
|
||||
{
|
||||
"meta": Meta(
|
||||
{
|
||||
"name": "foo",
|
||||
}
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
assert res == {"meta": {"name": "foo"}}
|
||||
|
||||
|
||||
def test_make_machine_minimal() -> None:
|
||||
# Empty is valid
|
||||
res = Machine({})
|
||||
|
||||
assert res == {}
|
||||
|
||||
|
||||
def test_make_service_minimal() -> None:
|
||||
# Empty is valid
|
||||
res = Service({})
|
||||
|
||||
assert res == {}
|
||||
@@ -72,7 +72,7 @@ def test_add_module_to_inventory(
|
||||
|
||||
inventory = load_inventory_json(base_path)
|
||||
|
||||
inventory.services = {
|
||||
inventory["services"] = {
|
||||
"borgbackup": {
|
||||
"borg1": {
|
||||
"meta": {"name": "borg1"},
|
||||
|
||||
Reference in New Issue
Block a user