Skip to content

Self-hosted homelab infrastructure visualizer — interactive network diagram with live status monitoring

test(mcp): cover uninitialized backend client

Sebastianbc2130e31d46
diff --git a/mcp/tests/test_backend_client.py b/mcp/tests/test_backend_client.py
index 563bfc9..44d490a 100644
--- a/mcp/tests/test_backend_client.py
+++ b/mcp/tests/test_backend_client.py
@@ -20,6 +20,17 @@ def _client_answering(response: httpx.Response) -> BackendClient:
return backend
+async def test_request_reports_uninitialized_backend_client():
+ backend = BackendClient()
+
+ with pytest.raises(BackendError) as exc:
+ await backend.get("/api/v1/nodes")
+
+ assert exc.value.status_code == 503
+ assert exc.value.detail == "Backend client not initialized — startup failed"
+
+
@pytest.mark.anyio
async def test_a_string_detail_reaches_the_caller():
detail = "source_handle 'right-2' does not exist: node n1 has 0 connection point(s) on its right side."