2018-11-20 10:51:34 +00:00
|
|
|
"""The tests for the Light Switch platform."""
|
|
|
|
|
|
|
|
from homeassistant.setup import async_setup_component
|
2019-12-08 17:50:17 +00:00
|
|
|
|
2018-11-20 10:51:34 +00:00
|
|
|
|
|
|
|
async def test_default_state(hass):
|
2022-03-10 11:23:01 +00:00
|
|
|
"""Test light switch yaml config."""
|
2019-07-31 19:25:30 +00:00
|
|
|
await async_setup_component(
|
|
|
|
hass,
|
|
|
|
"light",
|
|
|
|
{
|
|
|
|
"light": {
|
|
|
|
"platform": "switch",
|
|
|
|
"entity_id": "switch.test",
|
|
|
|
"name": "Christmas Tree Lights",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2018-11-20 10:51:34 +00:00
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
2022-03-10 11:23:01 +00:00
|
|
|
assert hass.states.get("light.christmas_tree_lights")
|
2018-11-20 10:51:34 +00:00
|
|
|
|
|
|
|
|
2022-03-10 11:23:01 +00:00
|
|
|
async def test_default_state_no_name(hass):
|
|
|
|
"""Test light switch default name."""
|
2019-07-31 19:25:30 +00:00
|
|
|
await async_setup_component(
|
|
|
|
hass,
|
|
|
|
"light",
|
2022-03-10 11:23:01 +00:00
|
|
|
{
|
|
|
|
"light": {
|
|
|
|
"platform": "switch",
|
|
|
|
"entity_id": "switch.test",
|
|
|
|
}
|
|
|
|
},
|
2022-03-04 19:02:17 +00:00
|
|
|
)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
2022-03-10 11:23:01 +00:00
|
|
|
assert hass.states.get("light.light_switch")
|