mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Convert some test helpers to coroutines and adjust tests (#23352)
* Convert some test helpers to coroutines * Fix tests
This commit is contained in:
committed by
Martin Hjelmare
parent
86b017e2f0
commit
5376e15286
@@ -20,32 +20,30 @@ def setup_comp(hass):
|
||||
|
||||
async def test_state_attributes(hass):
|
||||
"""Test light state attributes."""
|
||||
common.async_turn_on(
|
||||
await common.async_turn_on(
|
||||
hass, ENTITY_LIGHT, xy_color=(.4, .4), brightness=25)
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get(ENTITY_LIGHT)
|
||||
assert light.is_on(hass, ENTITY_LIGHT)
|
||||
assert (0.4, 0.4) == state.attributes.get(light.ATTR_XY_COLOR)
|
||||
assert 25 == state.attributes.get(light.ATTR_BRIGHTNESS)
|
||||
assert (255, 234, 164) == state.attributes.get(light.ATTR_RGB_COLOR)
|
||||
assert 'rainbow' == state.attributes.get(light.ATTR_EFFECT)
|
||||
common.async_turn_on(
|
||||
await common.async_turn_on(
|
||||
hass, ENTITY_LIGHT, rgb_color=(251, 253, 255),
|
||||
white_value=254)
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get(ENTITY_LIGHT)
|
||||
assert 254 == state.attributes.get(light.ATTR_WHITE_VALUE)
|
||||
assert (250, 252, 255) == state.attributes.get(light.ATTR_RGB_COLOR)
|
||||
assert (0.319, 0.326) == state.attributes.get(light.ATTR_XY_COLOR)
|
||||
common.async_turn_on(hass, ENTITY_LIGHT, color_temp=400, effect='none')
|
||||
await hass.async_block_till_done()
|
||||
await common.async_turn_on(
|
||||
hass, ENTITY_LIGHT, color_temp=400, effect='none')
|
||||
state = hass.states.get(ENTITY_LIGHT)
|
||||
assert 400 == state.attributes.get(light.ATTR_COLOR_TEMP)
|
||||
assert 153 == state.attributes.get(light.ATTR_MIN_MIREDS)
|
||||
assert 500 == state.attributes.get(light.ATTR_MAX_MIREDS)
|
||||
assert 'none' == state.attributes.get(light.ATTR_EFFECT)
|
||||
common.async_turn_on(hass, ENTITY_LIGHT, kelvin=3000, brightness_pct=50)
|
||||
await hass.async_block_till_done()
|
||||
await common.async_turn_on(
|
||||
hass, ENTITY_LIGHT, kelvin=3000, brightness_pct=50)
|
||||
state = hass.states.get(ENTITY_LIGHT)
|
||||
assert 333 == state.attributes.get(light.ATTR_COLOR_TEMP)
|
||||
assert 127 == state.attributes.get(light.ATTR_BRIGHTNESS)
|
||||
|
||||
Reference in New Issue
Block a user