From 2e2ad0aaec207ef5fa0aaf37c3cfc26c36ea8f61 Mon Sep 17 00:00:00 2001 From: Simone Chemelli Date: Wed, 1 Apr 2026 14:41:39 +0200 Subject: [PATCH] Fix patching for DNS queries in Obihai (#166790) --- tests/components/obihai/test_config_flow.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/components/obihai/test_config_flow.py b/tests/components/obihai/test_config_flow.py index 9b73cd2db27..3b2b972d00c 100644 --- a/tests/components/obihai/test_config_flow.py +++ b/tests/components/obihai/test_config_flow.py @@ -144,15 +144,18 @@ async def test_dhcp_flow_auth_failure(hass: HomeAssistant) -> None: == DHCP_SERVICE_INFO.ip ) - # patch_gethostbyname fixture is active - result = await hass.config_entries.flow.async_configure( - result["flow_id"], - user_input={ - CONF_HOST: DHCP_SERVICE_INFO.ip, - CONF_USERNAME: "", - CONF_PASSWORD: "", - }, - ) + with ( + patch("homeassistant.components.obihai.config_flow.gethostbyname"), + ): + # Verify we get dropped into the normal user flow with non-default credentials + result = await hass.config_entries.flow.async_configure( + result["flow_id"], + user_input={ + CONF_HOST: DHCP_SERVICE_INFO.ip, + CONF_USERNAME: "", + CONF_PASSWORD: "", + }, + ) assert result["errors"]["base"] == "invalid_auth" assert result["step_id"] == "user"