webui: tests for machine config endpoints
This commit is contained in:
@@ -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}}}
|
||||
|
||||
Reference in New Issue
Block a user