MCPcopy Create free account
hub / github.com/Tong89/smartNode / TestHealthEndpoint

Class TestHealthEndpoint

tests/test_api_integration.py:77–101  ·  view source on GitHub ↗

健康检查接口契约。

Source from the content-addressed store, hash-verified

75# ---------------------------------------------------------------------------
76
77class TestHealthEndpoint:
78 """健康检查接口契约。"""
79
80 def test_returns_200(self, client):
81 resp = client.get("/api/health")
82 assert resp.status_code == 200
83
84 def test_response_contains_success(self, client):
85 data = _json(client.get("/api/health"))
86 assert data.get("success") is True
87
88 def test_response_contains_service(self, client):
89 data = _json(client.get("/api/health"))
90 assert "service" in data
91 assert isinstance(data["service"], str)
92
93 def test_response_contains_simulation_running(self, client):
94 data = _json(client.get("/api/health"))
95 assert "simulation_running" in data
96 assert isinstance(data["simulation_running"], bool)
97
98 def test_simulation_running_is_false(self, client):
99 """注入 autostart=False 的引擎时,simulation_running 应为 False。"""
100 data = _json(client.get("/api/health"))
101 assert data["simulation_running"] is False
102
103
104# ---------------------------------------------------------------------------

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected