1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 04:50:05 +00:00

Add lightweight API to get core state (#96860)

This commit is contained in:
J. Nick Koston
2023-07-19 13:31:48 -05:00
committed by GitHub
parent 39b242f154
commit 29aa89bea0
3 changed files with 37 additions and 0 deletions

View File

@@ -678,3 +678,19 @@ async def test_api_call_service_bad_data(
"/api/services/test_domain/test_service", json={"hello": 5}
)
assert resp.status == HTTPStatus.BAD_REQUEST
async def test_api_status(hass: HomeAssistant, mock_api_client: TestClient) -> None:
"""Test getting the api status."""
resp = await mock_api_client.get("/api/")
assert resp.status == HTTPStatus.OK
json = await resp.json()
assert json["message"] == "API running."
async def test_api_core_state(hass: HomeAssistant, mock_api_client: TestClient) -> None:
"""Test getting core status."""
resp = await mock_api_client.get("/api/core/state")
assert resp.status == HTTPStatus.OK
json = await resp.json()
assert json["state"] == "RUNNING"