Intelligent timeout handler for setup/bootstrap (#38329)

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
authored and GitHub committed 2020-08-05 14:58:19 +02:00
1 parent caca762088
commit c291d4aa7d
21 files changed
+901 -89

No files matched your search

+20
View File
@@ -104,6 +104,7 @@ async def test_valid_config_with_info(hass):
}
},
)
await hass.async_block_till_done()
async def test_valid_config_no_name(hass):
@@ -114,6 +115,7 @@ async def test_valid_config_no_name(hass):
"switch",
{"switch": {"platform": "flux", "lights": ["light.desk", "light.lamp"]}},
)
await hass.async_block_till_done()
async def test_invalid_config_no_lights(hass):
@@ -122,6 +124,7 @@ async def test_invalid_config_no_lights(hass):
assert await async_setup_component(
hass, "switch", {"switch": {"platform": "flux", "name": "flux"}}
)
await hass.async_block_till_done()
async def test_flux_when_switch_is_off(hass, legacy_patchable_time):
@@ -168,6 +171,7 @@ async def test_flux_when_switch_is_off(hass, legacy_patchable_time):
}
},
)
await hass.async_block_till_done()
async_fire_time_changed(hass, test_time)
await hass.async_block_till_done()
@@ -218,6 +222,7 @@ async def test_flux_before_sunrise(hass, legacy_patchable_time):
}
},
)
await hass.async_block_till_done()
turn_on_calls = async_mock_service(hass, light.DOMAIN, SERVICE_TURN_ON)
await common.async_turn_on(hass, "switch.flux")
await hass.async_block_till_done()
@@ -271,6 +276,7 @@ async def test_flux_before_sunrise_known_location(hass, legacy_patchable_time):
}
},
)
await hass.async_block_till_done()
turn_on_calls = async_mock_service(hass, light.DOMAIN, SERVICE_TURN_ON)
await common.async_turn_on(hass, "switch.flux")
await hass.async_block_till_done()
@@ -325,6 +331,7 @@ async def test_flux_after_sunrise_before_sunset(hass, legacy_patchable_time):
}
},
)
await hass.async_block_till_done()
turn_on_calls = async_mock_service(hass, light.DOMAIN, SERVICE_TURN_ON)
await common.async_turn_on(hass, "switch.flux")
await hass.async_block_till_done()
@@ -380,6 +387,7 @@ async def test_flux_after_sunset_before_stop(hass, legacy_patchable_time):
}
},
)
await hass.async_block_till_done()
turn_on_calls = async_mock_service(hass, light.DOMAIN, SERVICE_TURN_ON)
common.turn_on(hass, "switch.flux")
await hass.async_block_till_done()
@@ -434,6 +442,7 @@ async def test_flux_after_stop_before_sunrise(hass, legacy_patchable_time):
}
},
)
await hass.async_block_till_done()
turn_on_calls = async_mock_service(hass, light.DOMAIN, SERVICE_TURN_ON)
common.turn_on(hass, "switch.flux")
await hass.async_block_till_done()
@@ -490,6 +499,7 @@ async def test_flux_with_custom_start_stop_times(hass, legacy_patchable_time):
}
},
)
await hass.async_block_till_done()
turn_on_calls = async_mock_service(hass, light.DOMAIN, SERVICE_TURN_ON)
common.turn_on(hass, "switch.flux")
await hass.async_block_till_done()
@@ -547,6 +557,7 @@ async def test_flux_before_sunrise_stop_next_day(hass, legacy_patchable_time):
}
},
)
await hass.async_block_till_done()
turn_on_calls = async_mock_service(hass, light.DOMAIN, SERVICE_TURN_ON)
common.turn_on(hass, "switch.flux")
await hass.async_block_till_done()
@@ -608,6 +619,7 @@ async def test_flux_after_sunrise_before_sunset_stop_next_day(
}
},
)
await hass.async_block_till_done()
turn_on_calls = async_mock_service(hass, light.DOMAIN, SERVICE_TURN_ON)
common.turn_on(hass, "switch.flux")
await hass.async_block_till_done()
@@ -669,6 +681,7 @@ async def test_flux_after_sunset_before_midnight_stop_next_day(
}
},
)
await hass.async_block_till_done()
turn_on_calls = async_mock_service(hass, light.DOMAIN, SERVICE_TURN_ON)
common.turn_on(hass, "switch.flux")
await hass.async_block_till_done()
@@ -729,6 +742,7 @@ async def test_flux_after_sunset_after_midnight_stop_next_day(
}
},
)
await hass.async_block_till_done()
turn_on_calls = async_mock_service(hass, light.DOMAIN, SERVICE_TURN_ON)
common.turn_on(hass, "switch.flux")
await hass.async_block_till_done()
@@ -789,6 +803,7 @@ async def test_flux_after_stop_before_sunrise_stop_next_day(
}
},
)
await hass.async_block_till_done()
turn_on_calls = async_mock_service(hass, light.DOMAIN, SERVICE_TURN_ON)
common.turn_on(hass, "switch.flux")
await hass.async_block_till_done()
@@ -846,6 +861,7 @@ async def test_flux_with_custom_colortemps(hass, legacy_patchable_time):
}
},
)
await hass.async_block_till_done()
turn_on_calls = async_mock_service(hass, light.DOMAIN, SERVICE_TURN_ON)
common.turn_on(hass, "switch.flux")
await hass.async_block_till_done()
@@ -902,6 +918,7 @@ async def test_flux_with_custom_brightness(hass, legacy_patchable_time):
}
},
)
await hass.async_block_till_done()
turn_on_calls = async_mock_service(hass, light.DOMAIN, SERVICE_TURN_ON)
common.turn_on(hass, "switch.flux")
await hass.async_block_till_done()
@@ -974,6 +991,7 @@ async def test_flux_with_multiple_lights(hass, legacy_patchable_time):
}
},
)
await hass.async_block_till_done()
turn_on_calls = async_mock_service(hass, light.DOMAIN, SERVICE_TURN_ON)
common.turn_on(hass, "switch.flux")
await hass.async_block_till_done()
@@ -1033,6 +1051,7 @@ async def test_flux_with_mired(hass, legacy_patchable_time):
}
},
)
await hass.async_block_till_done()
turn_on_calls = async_mock_service(hass, light.DOMAIN, SERVICE_TURN_ON)
common.turn_on(hass, "switch.flux")
await hass.async_block_till_done()
@@ -1085,6 +1104,7 @@ async def test_flux_with_rgb(hass, legacy_patchable_time):
}
},
)
await hass.async_block_till_done()
turn_on_calls = async_mock_service(hass, light.DOMAIN, SERVICE_TURN_ON)
await common.async_turn_on(hass, "switch.flux")
await hass.async_block_till_done()