Add color mode support to switch light (#63124)
This commit is contained in:
parent
2172679f41
commit
78442d82d1
2 changed files with 18 additions and 1 deletions
|
@ -1,5 +1,10 @@
|
|||
"""The tests for the Light Switch platform."""
|
||||
|
||||
from homeassistant.components.light import (
|
||||
ATTR_COLOR_MODE,
|
||||
ATTR_SUPPORTED_COLOR_MODES,
|
||||
COLOR_MODE_ONOFF,
|
||||
)
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.components.light import common
|
||||
|
@ -31,6 +36,8 @@ async def test_default_state(hass):
|
|||
assert state.attributes.get("white_value") is None
|
||||
assert state.attributes.get("effect_list") is None
|
||||
assert state.attributes.get("effect") is None
|
||||
assert state.attributes.get(ATTR_SUPPORTED_COLOR_MODES) == [COLOR_MODE_ONOFF]
|
||||
assert state.attributes.get(ATTR_COLOR_MODE) is None
|
||||
|
||||
|
||||
async def test_light_service_calls(hass):
|
||||
|
@ -54,6 +61,10 @@ async def test_light_service_calls(hass):
|
|||
|
||||
assert hass.states.get("switch.decorative_lights").state == "on"
|
||||
assert hass.states.get("light.light_switch").state == "on"
|
||||
assert (
|
||||
hass.states.get("light.light_switch").attributes.get(ATTR_COLOR_MODE)
|
||||
== COLOR_MODE_ONOFF
|
||||
)
|
||||
|
||||
await common.async_turn_off(hass, "light.light_switch")
|
||||
await hass.async_block_till_done()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue