MCPcopy Create free account
hub / github.com/cifertech/DisplayKit / main

Function main

scripts/smoke_test_server.py:14–93  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12
13
14def main() -> None:
15 from fastapi.testclient import TestClient
16
17 import importlib
18
19 import server.main as m
20
21 os.environ.pop("DISPLAYKIT_ENV", None)
22 importlib.reload(m)
23 c = TestClient(m.app)
24
25 r = c.get("/api/health")
26 assert r.status_code == 200, r.text
27 j = r.json()
28 assert j["status"] == "ok" and j.get("service") == "displaykit"
29 print("OK GET /api/health (dev)", j)
30
31 r = c.get("/")
32 assert r.status_code == 200 and "<title>DisplayKit" in r.text
33 print("OK GET /")
34
35 r = c.post("/api/project/summary", json={"screens": []})
36 assert r.status_code == 200 and r.json()["ok"] is True
37 assert r.json()["element_count"] == 0
38 print("OK POST /api/project/summary (empty)")
39
40 r = c.post(
41 "/api/project/summary",
42 json={"screens": [{"id": "a", "name": "Home", "elements": [{"id": 1}]}]},
43 )
44 assert r.json()["element_count"] == 1
45 print("OK POST /api/project/summary (1 element)")
46
47 r = c.get("/docs")
48 assert r.status_code == 200
49 print("OK GET /docs (dev)")
50
51 r = c.post(
52 "/api/icons/export",
53 json={
54 "mode": "tft_rgb565",
55 "bg_color": "#000000",
56 "icons": [{"file": "16x16/wifi_1.png"}],
57 },
58 )
59 assert r.status_code == 200, r.text
60 ex = r.json()
61 assert ex.get("ok") is True and "uint16_t" in ex.get("content", "")
62 print("OK POST /api/icons/export (tft_rgb565)")
63
64 r = c.post(
65 "/api/icons/export",
66 json={
67 "mode": "u8g2_xbm",
68 "bg_color": "#000000",
69 "icons": [{"file": "16x16/wifi_1.png"}],
70 },
71 )

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected