Convert some test helpers to coroutines and adjust tests (#23352)
* Convert some test helpers to coroutines * Fix tests
This commit is contained in:
1 parent
86b017e2f0
commit
5376e15286
24 files changed
+498
-991
No files matched your search
@@ -65,9 +65,7 @@ async def test_lights_on_when_sun_sets(hass, scanner):
|
||||
hass, device_sun_light_trigger.DOMAIN, {
|
||||
device_sun_light_trigger.DOMAIN: {}})
|
||||
|
||||
common_light.async_turn_off(hass)
|
||||
|
||||
await hass.async_block_till_done()
|
||||
await common_light.async_turn_off(hass)
|
||||
|
||||
test_time = test_time.replace(hour=3)
|
||||
with patch('homeassistant.util.dt.utcnow', return_value=test_time):
|
||||
@@ -79,9 +77,7 @@ async def test_lights_on_when_sun_sets(hass, scanner):
|
||||
|
||||
async def test_lights_turn_off_when_everyone_leaves(hass, scanner):
|
||||
"""Test lights turn off when everyone leaves the house."""
|
||||
common_light.async_turn_on(hass)
|
||||
|
||||
await hass.async_block_till_done()
|
||||
await common_light.async_turn_on(hass)
|
||||
|
||||
assert await async_setup_component(
|
||||
hass, device_sun_light_trigger.DOMAIN, {
|
||||
@@ -99,8 +95,7 @@ async def test_lights_turn_on_when_coming_home_after_sun_set(hass, scanner):
|
||||
"""Test lights turn on when coming home after sun set."""
|
||||
test_time = datetime(2017, 4, 5, 3, 2, 3, tzinfo=dt_util.UTC)
|
||||
with patch('homeassistant.util.dt.utcnow', return_value=test_time):
|
||||
common_light.async_turn_off(hass)
|
||||
await hass.async_block_till_done()
|
||||
await common_light.async_turn_off(hass)
|
||||
|
||||
assert await async_setup_component(
|
||||
hass, device_sun_light_trigger.DOMAIN, {
|
||||
|
||||
Reference in new issue
Block a user