Fix hassio mqtt discovery CI test (#104463)

* Fix hassio mqtt discovery CI test

* Avoid mqtt set up before mocking the flow

* Fix mock
pull/104476/head
Jan Bouwhuis 2023-11-24 21:54:53 +01:00 committed by GitHub
parent d4458cbac4
commit 19040becd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -1304,11 +1304,12 @@ async def get_system_health_info(hass: HomeAssistant, domain: str) -> dict[str,
@contextmanager
def mock_config_flow(domain: str, config_flow: type[ConfigFlow]) -> None:
"""Mock a config flow handler."""
assert domain not in config_entries.HANDLERS
handler = config_entries.HANDLERS.get(domain)
config_entries.HANDLERS[domain] = config_flow
_LOGGER.info("Adding mock config flow: %s", domain)
yield
config_entries.HANDLERS.pop(domain)
if handler:
config_entries.HANDLERS[domain] = handler
def mock_integration(