Support variables in templates with timeout (#66990)

This commit is contained in:
Mike Degatano 2022-02-21 12:56:20 -05:00 committed by GitHub
parent 0dfc4ec9be
commit 8ea6cbc257
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 1 deletions

View file

@ -706,6 +706,38 @@ async def test_render_template_renders_template(hass, websocket_client):
}
async def test_render_template_with_timeout_and_variables(hass, websocket_client):
"""Test a template with a timeout and variables renders without error."""
await websocket_client.send_json(
{
"id": 5,
"type": "render_template",
"timeout": 10,
"variables": {"test": {"value": "hello"}},
"template": "{{ test.value }}",
}
)
msg = await websocket_client.receive_json()
assert msg["id"] == 5
assert msg["type"] == const.TYPE_RESULT
assert msg["success"]
msg = await websocket_client.receive_json()
assert msg["id"] == 5
assert msg["type"] == "event"
event = msg["event"]
assert event == {
"result": "hello",
"listeners": {
"all": False,
"domains": [],
"entities": [],
"time": False,
},
}
async def test_render_template_manual_entity_ids_no_longer_needed(
hass, websocket_client
):