mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Give mqtt test more time to process subscriptions (#103006)
This commit is contained in:
parent
a373f5eac5
commit
d6a0f9b5a0
@ -1523,18 +1523,20 @@ async def test_mqtt_integration_discovery_subscribe_unsubscribe(
|
|||||||
return self.async_abort(reason="already_configured")
|
return self.async_abort(reason="already_configured")
|
||||||
|
|
||||||
with patch.dict(config_entries.HANDLERS, {"comp": TestFlow}):
|
with patch.dict(config_entries.HANDLERS, {"comp": TestFlow}):
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0)
|
||||||
assert ("comp/discovery/#", 0) in help_all_subscribe_calls(mqtt_client_mock)
|
assert ("comp/discovery/#", 0) in help_all_subscribe_calls(mqtt_client_mock)
|
||||||
assert not mqtt_client_mock.unsubscribe.called
|
assert not mqtt_client_mock.unsubscribe.called
|
||||||
|
|
||||||
async_fire_mqtt_message(hass, "comp/discovery/bla/config", "")
|
async_fire_mqtt_message(hass, "comp/discovery/bla/config", "")
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0)
|
||||||
|
await hass.async_block_till_done()
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
mqtt_client_mock.unsubscribe.assert_called_once_with(["comp/discovery/#"])
|
mqtt_client_mock.unsubscribe.assert_called_once_with(["comp/discovery/#"])
|
||||||
mqtt_client_mock.unsubscribe.reset_mock()
|
mqtt_client_mock.unsubscribe.reset_mock()
|
||||||
|
|
||||||
async_fire_mqtt_message(hass, "comp/discovery/bla/config", "")
|
async_fire_mqtt_message(hass, "comp/discovery/bla/config", "")
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0)
|
||||||
|
await hass.async_block_till_done()
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert not mqtt_client_mock.unsubscribe.called
|
assert not mqtt_client_mock.unsubscribe.called
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user