Improve mobile app template handling (#41703)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Paulus SchoutsenandJ. Nick Koston authored and GitHub committed 2020-10-12 17:26:54 +02:00
1 parent feabf99f92
commit 57996e1942
2 files changed
+24 -9

No files matched your search

+15 -2
View File
@@ -70,13 +70,26 @@ async def test_webhook_handle_render_template(create_registrations, webhook_clie
"""Test that we render templates properly."""
resp = await webhook_client.post(
"/api/webhook/{}".format(create_registrations[1]["webhook_id"]),
json=RENDER_TEMPLATE,
json={
"type": "render_template",
"data": {
"one": {"template": "Hello world"},
"two": {"template": "{{ now() | random }}"},
"three": {"template": "{{ now() 3 }}"},
},
},
)
assert resp.status == 200
json = await resp.json()
assert json == {"one": "Hello world"}
assert json == {
"one": "Hello world",
"two": {"error": "TypeError: object of type 'datetime.datetime' has no len()"},
"three": {
"error": "TemplateSyntaxError: expected token 'end of print statement', got 'integer'"
},
}
async def test_webhook_handle_call_services(hass, create_registrations, webhook_client):