mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Improve test coverage of template button (#63265)
This commit is contained in:
parent
6f8cd54ca1
commit
8f99cb51b5
@ -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"):
|
||||
|
Loading…
x
Reference in New Issue
Block a user