Clean mqtt patch.dict config entries (#104449)

This commit is contained in:
Martin Hjelmare 2023-11-24 10:56:17 +01:00 committed by GitHub
parent e03ccb5ab6
commit b3211fa5ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,6 +34,7 @@ from tests.common import (
MockConfigEntry,
async_capture_events,
async_fire_mqtt_message,
mock_config_flow,
mock_platform,
)
from tests.typing import (
@ -1522,7 +1523,7 @@ async def test_mqtt_integration_discovery_subscribe_unsubscribe(
"""Test mqtt step."""
return self.async_abort(reason="already_configured")
with patch.dict(config_entries.HANDLERS, {"comp": TestFlow}):
with mock_config_flow("comp", TestFlow):
await asyncio.sleep(0)
assert ("comp/discovery/#", 0) in help_all_subscribe_calls(mqtt_client_mock)
assert not mqtt_client_mock.unsubscribe.called
@ -1575,7 +1576,7 @@ async def test_mqtt_discovery_unsubscribe_once(
"""Test mqtt step."""
return self.async_abort(reason="already_configured")
with patch.dict(config_entries.HANDLERS, {"comp": TestFlow}):
with mock_config_flow("comp", TestFlow):
async_fire_mqtt_message(hass, "comp/discovery/bla/config", "")
async_fire_mqtt_message(hass, "comp/discovery/bla/config", "")
await asyncio.sleep(0.1)