mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Fix mqtt tests (#79079)
This commit is contained in:
parent
d9b58e5ef1
commit
75104159c6
@ -18,6 +18,7 @@ from homeassistant.const import (
|
|||||||
SERVICE_RELOAD,
|
SERVICE_RELOAD,
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
)
|
)
|
||||||
|
from homeassistant.generated.mqtt import MQTT
|
||||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
@ -48,6 +49,8 @@ DEFAULT_CONFIG_DEVICE_INFO_MAC = {
|
|||||||
|
|
||||||
_SENTINEL = object()
|
_SENTINEL = object()
|
||||||
|
|
||||||
|
DISCOVERY_COUNT = len(MQTT)
|
||||||
|
|
||||||
|
|
||||||
async def help_test_availability_when_connection_lost(
|
async def help_test_availability_when_connection_lost(
|
||||||
hass, mqtt_mock_entry_with_yaml_config, domain, config
|
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")
|
state = hass.states.get(f"{domain}.test")
|
||||||
assert state is not None
|
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:
|
for topic in topics:
|
||||||
mqtt_mock.async_subscribe.assert_any_call(topic, ANY, ANY, ANY)
|
mqtt_mock.async_subscribe.assert_any_call(topic, ANY, ANY, ANY)
|
||||||
mqtt_mock.async_subscribe.reset_mock()
|
mqtt_mock.async_subscribe.reset_mock()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user