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

Class TestHealthEndpoint

tests/test_api.py:87–107  ·  view source on GitHub ↗

健康检查接口基本契约。

Source from the content-addressed store, hash-verified

85
86
87class TestHealthEndpoint:
88 """健康检查接口基本契约。"""
89
90 def test_status_200(self, client):
91 assert client.get("/api/health").status_code == 200
92
93 def test_success_true(self, client):
94 assert _json(client.get("/api/health"))["success"] is True
95
96 def test_service_field_is_string(self, client):
97 data = _json(client.get("/api/health"))
98 assert "service" in data
99 assert isinstance(data["service"], str)
100
101 def test_simulation_running_is_bool(self, client):
102 data = _json(client.get("/api/health"))
103 assert isinstance(data.get("simulation_running"), bool)
104
105 def test_simulation_not_running_with_test_engine(self, client):
106 """注入 autostart=False 引擎时 simulation_running 应为 False。"""
107 assert _json(client.get("/api/health"))["simulation_running"] is False
108
109
110# ---------------------------------------------------------------------------

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected