Skip to content

Commit c899a21

Browse files
authored
Create test_web_dashboard.py
1 parent 76e7b84 commit c899a21

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from synapdrive_ai.interface import web_dashboard
2+
3+
4+
def test_dashboard_home_route():
5+
client = web_dashboard.app.test_client()
6+
r = client.get("/")
7+
assert r.status_code == 200
8+
assert b"SynapDrive-AI Dashboard" in r.data
9+
10+
11+
def test_dashboard_text_api():
12+
client = web_dashboard.app.test_client()
13+
r = client.post("/api/run/text", json={"text": "stop", "image": "hazard"})
14+
assert r.status_code == 200
15+
payload = r.get_json()
16+
assert "status" in payload
17+
assert "result" in payload
18+
assert payload["result"]["status"] in {"success", "blocked"}
19+
20+
21+
def test_dashboard_log_api():
22+
client = web_dashboard.app.test_client()
23+
# generate one action so log is non-empty
24+
client.post("/api/run/text", json={"text": "move left", "image": "road"})
25+
26+
r = client.get("/api/log")
27+
assert r.status_code == 200
28+
payload = r.get_json()
29+
assert "count" in payload
30+
assert "log" in payload
31+
assert isinstance(payload["log"], list)

0 commit comments

Comments
 (0)