Split the Deluge user flow init from its data (#180752)

This commit is contained in:
Franck Nijhof
2026-08-30 12:23:50 +02:00
committed by GitHub
parent 267f06442b
commit e05f19894d
+36 -6
View File
@@ -58,9 +58,15 @@ def deluge_setup_fixture():
async def test_flow_user(hass: HomeAssistant, api) -> None:
"""Test user initialized flow."""
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.CREATE_ENTRY
assert result["title"] == DEFAULT_NAME
@@ -77,7 +83,15 @@ async def test_flow_user_already_configured(hass: HomeAssistant, api) -> None:
entry.add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=CONF_DATA
DOMAIN, context={CONF_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
@@ -87,7 +101,15 @@ async def test_flow_user_already_configured(hass: HomeAssistant, api) -> None:
async def test_flow_user_cannot_connect(hass: HomeAssistant, conn_error) -> None:
"""Test user initialized flow with unreachable server."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=CONF_DATA
DOMAIN, context={CONF_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"
@@ -97,7 +119,15 @@ async def test_flow_user_cannot_connect(hass: HomeAssistant, conn_error) -> None
async def test_flow_user_unknown_error(hass: HomeAssistant, unknown_error) -> None:
"""Test user initialized flow with unreachable server."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=CONF_DATA
DOMAIN, context={CONF_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"