machines: add endpoint machines/{name}/ verify

This commit is contained in:
DavHau
2023-10-24 16:30:58 +01:00
parent 3288185f66
commit f1e7495806
5 changed files with 71 additions and 12 deletions

View File

@@ -46,18 +46,40 @@ def test_configure_machine(api: TestClient, test_flake: Path) -> None:
assert "schema" in json_response and "properties" in json_response["schema"]
# set some config
response = api.put(
"/api/machines/machine1/config",
json=dict(
clan=dict(
jitsi=True,
)
config = dict(
clan=dict(
jitsi=dict(
enable=True,
),
),
fileSystems={
"/": dict(
device="/dev/fake_disk",
fsType="ext4",
),
},
# set boot.loader.grub.devices
boot=dict(
loader=dict(
grub=dict(
devices=["/dev/fake_disk"],
),
),
),
)
response = api.put(
"/api/machines/machine1/config",
json=config,
)
assert response.status_code == 200
assert response.json() == {"config": {"clan": {"jitsi": True}}}
assert response.json() == {"config": config}
# verify the machine config
response = api.get("/api/machines/machine1/verify")
assert response.status_code == 200
assert response.json() == {"success": True, "error": None}
# get the config again
response = api.get("/api/machines/machine1/config")
assert response.status_code == 200
assert response.json() == {"config": {"clan": {"jitsi": True}}}
assert response.json() == {"config": config}