1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +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:
Erik Montnemery
2019-04-25 10:14:16 +02:00
committed by Martin Hjelmare
parent 86b017e2f0
commit 5376e15286
24 changed files with 498 additions and 991 deletions

View File

@@ -37,20 +37,17 @@ async def test_light_service_calls(hass):
assert hass.states.get('light.light_switch').state == 'on'
common.async_toggle(hass, 'light.light_switch')
await hass.async_block_till_done()
await common.async_toggle(hass, 'light.light_switch')
assert hass.states.get('switch.decorative_lights').state == 'off'
assert hass.states.get('light.light_switch').state == 'off'
common.async_turn_on(hass, 'light.light_switch')
await hass.async_block_till_done()
await common.async_turn_on(hass, 'light.light_switch')
assert hass.states.get('switch.decorative_lights').state == 'on'
assert hass.states.get('light.light_switch').state == 'on'
common.async_turn_off(hass, 'light.light_switch')
await hass.async_block_till_done()
await common.async_turn_off(hass, 'light.light_switch')
assert hass.states.get('switch.decorative_lights').state == 'off'
assert hass.states.get('light.light_switch').state == 'off'
@@ -68,14 +65,12 @@ async def test_switch_service_calls(hass):
assert hass.states.get('light.light_switch').state == 'on'
switch_common.async_turn_off(hass, 'switch.decorative_lights')
await hass.async_block_till_done()
await switch_common.async_turn_off(hass, 'switch.decorative_lights')
assert hass.states.get('switch.decorative_lights').state == 'off'
assert hass.states.get('light.light_switch').state == 'off'
switch_common.async_turn_on(hass, 'switch.decorative_lights')
await hass.async_block_till_done()
await switch_common.async_turn_on(hass, 'switch.decorative_lights')
assert hass.states.get('switch.decorative_lights').state == 'on'
assert hass.states.get('light.light_switch').state == 'on'