Delete devices / entities when we remove a config entry. (#23983)

* Remove device when last config entry removed

* Remove entities when config entry removed

* Update tests to use new behaviour
This commit is contained in:
Penny Wood 2019-05-19 17:41:39 +08:00 committed by Paulus Schoutsen
parent d7d83c683d
commit f991ec15f2
5 changed files with 27 additions and 13 deletions

View file

@ -213,15 +213,14 @@ async def test_removing_config_entry_id(hass, registry, update_events):
assert entry.config_entry_id == 'mock-id-1'
registry.async_clear_config_entry('mock-id-1')
entry = registry.entities[entry.entity_id]
assert entry.config_entry_id is None
assert not registry.entities
await hass.async_block_till_done()
assert len(update_events) == 2
assert update_events[0]['action'] == 'create'
assert update_events[0]['entity_id'] == entry.entity_id
assert update_events[1]['action'] == 'update'
assert update_events[1]['action'] == 'remove'
assert update_events[1]['entity_id'] == entry.entity_id