Improve test coverage of template button (#63265)

pull/63274/head
Erik Montnemery 2022-01-03 10:39:24 +01:00 committed by GitHub
parent 6f8cd54ca1
commit 8f99cb51b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 0 deletions

View File

@ -128,6 +128,36 @@ async def test_all_optional_config(hass, calls):
assert er.async_get_entity_id("button", "template", "test-test")
async def test_name_template(hass, calls):
"""Test: name template."""
with assert_setup_component(1, "template"):
assert await setup.async_setup_component(
hass,
"template",
{
"template": {
"button": {
"press": {"service": "script.press"},
"name": "Button {{ 1 + 1 }}",
},
}
},
)
await hass.async_block_till_done()
await hass.async_start()
await hass.async_block_till_done()
_verify(
hass,
STATE_UNKNOWN,
{
CONF_FRIENDLY_NAME: "Button 2",
},
"button.button_2",
)
async def test_unique_id(hass, calls):
"""Test: unique id is ok."""
with assert_setup_component(1, "template"):