From 9004deefae68a49ddd75b9bb092784eec33bb585 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 2 Mar 2023 10:58:35 -1000 Subject: [PATCH] add a bit more coverage just to be sure --- tests/components/api/test_init.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/components/api/test_init.py b/tests/components/api/test_init.py index 570bb980aba..04c186bf211 100644 --- a/tests/components/api/test_init.py +++ b/tests/components/api/test_init.py @@ -349,6 +349,16 @@ async def test_api_template(hass: HomeAssistant, mock_api_client: TestClient) -> assert body == "10" + hass.states.async_set("sensor.temperature", 20) + resp = await mock_api_client.post( + const.URL_API_TEMPLATE, + json={"template": "{{ states.sensor.temperature.state }}"}, + ) + + body = await resp.text() + + assert body == "20" + async def test_api_template_error( hass: HomeAssistant, mock_api_client: TestClient