Fix wiz test warning (#116693)

This commit is contained in:
Marc Mueller 2024-05-06 19:10:06 +02:00 committed by GitHub
parent 485f3b0f0a
commit 52b8c189d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -44,7 +44,7 @@ async def test_cleanup_on_shutdown(hass: HomeAssistant) -> None:
_, entry = await async_setup_integration(hass, wizlight=bulb)
assert entry.state is ConfigEntryState.LOADED
hass.bus.async_fire(EVENT_HOMEASSISTANT_STOP)
await hass.async_block_till_done()
await hass.async_block_till_done(wait_background_tasks=True)
bulb.async_close.assert_called_once()
@ -63,7 +63,7 @@ async def test_cleanup_on_failed_first_update(hass: HomeAssistant) -> None:
_patch_wizlight(device=bulb),
):
await async_setup_component(hass, DOMAIN, {DOMAIN: {}})
await hass.async_block_till_done()
await hass.async_block_till_done(wait_background_tasks=True)
assert entry.state is ConfigEntryState.SETUP_RETRY
bulb.async_close.assert_called_once()
@ -74,6 +74,7 @@ async def test_wrong_device_now_has_our_ip(hass: HomeAssistant) -> None:
bulb.mac = "dddddddddddd"
_, entry = await async_setup_integration(hass, wizlight=bulb)
assert entry.state is ConfigEntryState.SETUP_RETRY
await hass.async_block_till_done(wait_background_tasks=True)
async def test_reload_on_title_change(hass: HomeAssistant) -> None:
@ -81,12 +82,12 @@ async def test_reload_on_title_change(hass: HomeAssistant) -> None:
bulb = _mocked_wizlight(None, None, FAKE_SOCKET)
_, entry = await async_setup_integration(hass, wizlight=bulb)
assert entry.state is ConfigEntryState.LOADED
await hass.async_block_till_done()
await hass.async_block_till_done(wait_background_tasks=True)
with _patch_discovery(), _patch_wizlight(device=bulb):
hass.config_entries.async_update_entry(entry, title="Shop Switch")
assert entry.title == "Shop Switch"
await hass.async_block_till_done()
await hass.async_block_till_done(wait_background_tasks=True)
assert (
hass.states.get("switch.mock_title").attributes[ATTR_FRIENDLY_NAME]