Fix GDACS integration to remove stale entities from entity registry (#33283)
* remove entities from entity registry * added test for removing entities from entity registry
This commit is contained in:
1 parent
558cccc68c
commit
a38db1f677
2 files changed
+8
No files matched your search
@@ -29,6 +29,7 @@ from homeassistant.const import (
|
||||
CONF_RADIUS,
|
||||
EVENT_HOMEASSISTANT_START,
|
||||
)
|
||||
from homeassistant.helpers.entity_registry import async_get_registry
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.util.unit_system import IMPERIAL_SYSTEM
|
||||
@@ -97,6 +98,8 @@ async def test_setup(hass):
|
||||
all_states = hass.states.async_all()
|
||||
# 3 geolocation and 1 sensor entities
|
||||
assert len(all_states) == 4
|
||||
entity_registry = await async_get_registry(hass)
|
||||
assert len(entity_registry.entities) == 4
|
||||
|
||||
state = hass.states.get("geo_location.drought_name_1")
|
||||
assert state is not None
|
||||
@@ -184,6 +187,7 @@ async def test_setup(hass):
|
||||
|
||||
all_states = hass.states.async_all()
|
||||
assert len(all_states) == 1
|
||||
assert len(entity_registry.entities) == 1
|
||||
|
||||
|
||||
async def test_setup_imperial(hass):
|
||||
|
||||
Reference in new issue
Block a user