webui: tests for machine config endpoints

This commit is contained in:
DavHau
2023-08-26 08:46:53 +02:00
parent 7dd5add64b
commit 518bf4197f
8 changed files with 76 additions and 48 deletions

View File

@@ -19,3 +19,26 @@ def test_machines(api: TestClient, clan_flake: Path) -> None:
response = api.get("/api/machines")
assert response.status_code == 200
assert response.json() == {"machines": [{"name": "test", "status": "unknown"}]}
def test_configure_machine(api: TestClient, machine_flake: Path) -> None:
response = api.get("/api/machines/machine1/config")
assert response.status_code == 200
assert response.json() == {"config": dict()}
# set some config
response = api.put(
"/api/machines/machine1/config",
json=dict(
clan=dict(
jitsi=True,
)
),
)
assert response.status_code == 200
assert response.json() == {"config": {"clan": {"jitsi": True}}}
# get the config again
response = api.get("/api/machines/machine1/config")
assert response.status_code == 200
assert response.json() == {"config": {"clan": {"jitsi": True}}}