diff --git a/tests/components/mqtt/test_common.py b/tests/components/mqtt/test_common.py index 0ac7e64d1bb..a9cfb88bfb6 100644 --- a/tests/components/mqtt/test_common.py +++ b/tests/components/mqtt/test_common.py @@ -18,6 +18,7 @@ from homeassistant.const import ( SERVICE_RELOAD, STATE_UNAVAILABLE, ) +from homeassistant.generated.mqtt import MQTT from homeassistant.helpers import device_registry as dr, entity_registry as er from homeassistant.helpers.dispatcher import async_dispatcher_send from homeassistant.setup import async_setup_component @@ -48,6 +49,8 @@ DEFAULT_CONFIG_DEVICE_INFO_MAC = { _SENTINEL = object() +DISCOVERY_COUNT = len(MQTT) + async def help_test_availability_when_connection_lost( hass, mqtt_mock_entry_with_yaml_config, domain, config @@ -1083,7 +1086,7 @@ async def help_test_entity_id_update_subscriptions( state = hass.states.get(f"{domain}.test") assert state is not None - assert mqtt_mock.async_subscribe.call_count == len(topics) + 3 + assert mqtt_mock.async_subscribe.call_count == len(topics) + 2 + DISCOVERY_COUNT for topic in topics: mqtt_mock.async_subscribe.assert_any_call(topic, ANY, ANY, ANY) mqtt_mock.async_subscribe.reset_mock()