From a9b7273df05dd2ef518093eebef96bc2be59ef61 Mon Sep 17 00:00:00 2001 From: Manu Date: Thu, 1 Oct 2026 17:27:33 +0200 Subject: [PATCH] Split user flow init and data submission in p1_monitor config flow tests (#183914) --- tests/components/p1_monitor/test_config_flow.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/components/p1_monitor/test_config_flow.py b/tests/components/p1_monitor/test_config_flow.py index 1aa3e48f0604..83ff9f21270a 100644 --- a/tests/components/p1_monitor/test_config_flow.py +++ b/tests/components/p1_monitor/test_config_flow.py @@ -44,14 +44,21 @@ async def test_full_user_flow(hass: HomeAssistant) -> None: async def test_api_error(hass: HomeAssistant) -> None: """Test we handle cannot connect error.""" + result = await hass.config_entries.flow.async_init( + DOMAIN, context={"source": SOURCE_USER} + ) + + assert result.get("type") is FlowResultType.FORM + assert result.get("step_id") == "user" + assert not result.get("errors") + with patch( "homeassistant.components.p1_monitor.coordinator.P1Monitor.settings", side_effect=P1MonitorError, ): - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_USER}, - data={CONF_HOST: "example.com", CONF_PORT: 80}, + result = await hass.config_entries.flow.async_configure( + result["flow_id"], + user_input={CONF_HOST: "example.com", CONF_PORT: 80}, ) assert result.get("type") is FlowResultType.FORM