core/tests/components/switch/test_light.py

39 lines
925 B
Python
Raw Normal View History

"""The tests for the Light Switch platform."""
from homeassistant.setup import async_setup_component
async def test_default_state(hass):
"""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",
}
},
)
await hass.async_block_till_done()
assert hass.states.get("light.christmas_tree_lights")
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",
{
"light": {
"platform": "switch",
"entity_id": "switch.test",
}
},
)
await hass.async_block_till_done()
assert hass.states.get("light.light_switch")