mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 02:49:40 +00:00
Fix MQTT threading bug (#43667)
This commit is contained in:
@@ -638,8 +638,9 @@ async def test_restore_subscriptions_on_reconnect(hass, mqtt_client_mock, mqtt_m
|
||||
assert mqtt_client_mock.subscribe.call_count == 1
|
||||
|
||||
mqtt_mock._mqtt_on_disconnect(None, None, 0)
|
||||
mqtt_mock._mqtt_on_connect(None, None, None, 0)
|
||||
await hass.async_block_till_done()
|
||||
with patch("homeassistant.components.mqtt.DISCOVERY_COOLDOWN", 0):
|
||||
mqtt_mock._mqtt_on_connect(None, None, None, 0)
|
||||
await hass.async_block_till_done()
|
||||
assert mqtt_client_mock.subscribe.call_count == 2
|
||||
|
||||
|
||||
@@ -671,8 +672,9 @@ async def test_restore_all_active_subscriptions_on_reconnect(
|
||||
assert mqtt_client_mock.unsubscribe.call_count == 0
|
||||
|
||||
mqtt_mock._mqtt_on_disconnect(None, None, 0)
|
||||
mqtt_mock._mqtt_on_connect(None, None, None, 0)
|
||||
await hass.async_block_till_done()
|
||||
with patch("homeassistant.components.mqtt.DISCOVERY_COOLDOWN", 0):
|
||||
mqtt_mock._mqtt_on_connect(None, None, None, 0)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
expected.append(call("test/state", 1))
|
||||
assert mqtt_client_mock.subscribe.mock_calls == expected
|
||||
|
||||
Reference in New Issue
Block a user