From de2f8b61cbdd8d592c2ee0fdada6316fb37a0a38 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sun, 30 Aug 2026 12:24:02 +0200 Subject: [PATCH] Split the D-Link user flow init from its data (#180751) --- tests/components/dlink/test_config_flow.py | 30 +++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/tests/components/dlink/test_config_flow.py b/tests/components/dlink/test_config_flow.py index 6998299c76fa..f3403aafc463 100644 --- a/tests/components/dlink/test_config_flow.py +++ b/tests/components/dlink/test_config_flow.py @@ -45,7 +45,15 @@ async def test_flow_user_already_configured( ) -> None: """Test user initialized flow with duplicate server.""" result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA + 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_DATA, ) assert result["type"] is FlowResultType.ABORT @@ -60,7 +68,15 @@ async def test_flow_user_cannot_connect( """Test user initialized flow with unreachable server.""" with patch_config_flow(mocked_plug_legacy_no_auth): result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA + 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_DATA, ) assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -83,7 +99,15 @@ async def test_flow_user_unknown_error( with patch_config_flow(mocked_plug) as mock: mock.side_effect = Exception result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA + 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_DATA, ) assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user"