From 34de7104f28143b4524ded26e1293c7a78bb5325 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sun, 30 Aug 2026 12:20:06 +0200 Subject: [PATCH] Split the HKO user flow init from its data (#180742) --- tests/components/hko/test_config_flow.py | 48 ++++++++++++++++++------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/tests/components/hko/test_config_flow.py b/tests/components/hko/test_config_flow.py index 7a2cec961db0..9d303de39a01 100644 --- a/tests/components/hko/test_config_flow.py +++ b/tests/components/hko/test_config_flow.py @@ -37,9 +37,15 @@ async def test_config_flow_cannot_connect(hass: HomeAssistant) -> None: with patch("homeassistant.components.hko.config_flow.HKO.weather") as client_mock: client_mock.side_effect = HKOError() result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_USER}, - data={CONF_LOCATION: DEFAULT_LOCATION}, + DOMAIN, context={"source": SOURCE_USER} + ) + + assert result["type"] is FlowResultType.FORM + assert result["step_id"] == "user" + + result = await hass.config_entries.flow.async_configure( + result["flow_id"], + user_input={CONF_LOCATION: DEFAULT_LOCATION}, ) assert result["type"] is FlowResultType.FORM @@ -48,9 +54,15 @@ async def test_config_flow_cannot_connect(hass: HomeAssistant) -> None: client_mock.side_effect = None result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_USER}, - data={CONF_LOCATION: DEFAULT_LOCATION}, + DOMAIN, context={"source": SOURCE_USER} + ) + + assert result["type"] is FlowResultType.FORM + assert result["step_id"] == "user" + + result = await hass.config_entries.flow.async_configure( + result["flow_id"], + user_input={CONF_LOCATION: DEFAULT_LOCATION}, ) assert result["type"] is FlowResultType.CREATE_ENTRY @@ -63,9 +75,15 @@ async def test_config_flow_timeout(hass: HomeAssistant) -> None: with patch("homeassistant.components.hko.config_flow.HKO.weather") as client_mock: client_mock.side_effect = TimeoutError() result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_USER}, - data={CONF_LOCATION: DEFAULT_LOCATION}, + DOMAIN, context={"source": SOURCE_USER} + ) + + assert result["type"] is FlowResultType.FORM + assert result["step_id"] == "user" + + result = await hass.config_entries.flow.async_configure( + result["flow_id"], + user_input={CONF_LOCATION: DEFAULT_LOCATION}, ) assert result["type"] is FlowResultType.FORM @@ -74,9 +92,15 @@ async def test_config_flow_timeout(hass: HomeAssistant) -> None: client_mock.side_effect = None result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_USER}, - data={CONF_LOCATION: DEFAULT_LOCATION}, + DOMAIN, context={"source": SOURCE_USER} + ) + + assert result["type"] is FlowResultType.FORM + assert result["step_id"] == "user" + + result = await hass.config_entries.flow.async_configure( + result["flow_id"], + user_input={CONF_LOCATION: DEFAULT_LOCATION}, ) assert result["type"] is FlowResultType.CREATE_ENTRY