Split the D-Link user flow init from its data (#180751)

This commit is contained in:
Franck Nijhof
2026-08-30 12:24:02 +02:00
committed by GitHub
parent e05f19894d
commit de2f8b61cb
+27 -3
View File
@@ -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"