Cleanup entity and device registry on MQTT discovery removal (#32693)

* Cleanup entity and device registry on MQTT discovery removal.

* Review comments
This commit is contained in:
Erik Montnemery 2020-03-12 02:00:47 +01:00 committed by GitHub
parent 5f5cb8bea8
commit 8bc542776b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 466 additions and 17 deletions

View file

@ -30,6 +30,7 @@ from .common import (
help_test_discovery_removal,
help_test_discovery_update,
help_test_discovery_update_attr,
help_test_entity_device_info_remove,
help_test_entity_device_info_update,
help_test_entity_device_info_with_identifier,
help_test_entity_id_update,
@ -893,6 +894,19 @@ async def test_entity_device_info_update(hass, mqtt_mock):
)
async def test_entity_device_info_remove(hass, mqtt_mock):
"""Test device registry remove."""
config = {
"platform": "mqtt",
"name": "Test 1",
"power_state_topic": "test-topic",
"power_command_topic": "test-command-topic",
"device": {"identifiers": ["helloworld"]},
"unique_id": "veryunique",
}
await help_test_entity_device_info_remove(hass, mqtt_mock, CLIMATE_DOMAIN, config)
async def test_entity_id_update(hass, mqtt_mock):
"""Test MQTT subscriptions are managed when entity_id is updated."""
config = {