Mark entities as unavailable when they are removed but are still registered (#45528)
* Mark entities as unavailable when they are removed but are still registered * Add sync_entity_lifecycle to collection helper * Remove debug print * Lint * Fix tests * Fix tests * Update zha * Update zone * Fix tests * Update hyperion * Update rfxtrx * Fix tests * Pass force_remove=True from integrations Co-authored-by: Erik <erik@montnemery.com>
This commit is contained in:
parent
aa005af266
commit
9e07910ab0
73 changed files with 439 additions and 222 deletions
|
@ -1,6 +1,7 @@
|
|||
"""Tests for init module."""
|
||||
from homeassistant.components.nws.const import DOMAIN
|
||||
from homeassistant.components.weather import DOMAIN as WEATHER_DOMAIN
|
||||
from homeassistant.const import STATE_UNAVAILABLE
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.nws.const import NWS_CONFIG
|
||||
|
@ -25,5 +26,12 @@ async def test_unload_entry(hass, mock_simple_nws):
|
|||
assert len(entries) == 1
|
||||
|
||||
assert await hass.config_entries.async_unload(entries[0].entry_id)
|
||||
assert len(hass.states.async_entity_ids(WEATHER_DOMAIN)) == 0
|
||||
entities = hass.states.async_entity_ids(WEATHER_DOMAIN)
|
||||
assert len(entities) == 1
|
||||
for entity in entities:
|
||||
assert hass.states.get(entity).state == STATE_UNAVAILABLE
|
||||
assert DOMAIN not in hass.data
|
||||
|
||||
assert await hass.config_entries.async_remove(entries[0].entry_id)
|
||||
await hass.async_block_till_done()
|
||||
assert len(hass.states.async_entity_ids(WEATHER_DOMAIN)) == 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue