Split the Discord user flow init from its data (#180756)

This commit is contained in:
Franck Nijhof
2026-08-30 12:26:37 +02:00
committed by GitHub
parent ab69d806f2
commit 54363d31ce
+27 -9
View File
@@ -56,9 +56,15 @@ async def test_flow_user_invalid_auth(hass: HomeAssistant) -> None:
with patch_discord_login() as mock:
mock.side_effect = nextcord.LoginFailure
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_USER},
data=CONF_DATA,
DOMAIN, context={"source": config_entries.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_INPUT,
)
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"
@@ -79,9 +85,15 @@ async def test_flow_user_cannot_connect(hass: HomeAssistant) -> None:
with patch_discord_login() as mock:
mock.side_effect = mock_exception()
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_USER},
data=CONF_DATA,
DOMAIN, context={"source": config_entries.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_INPUT,
)
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"
@@ -102,9 +114,15 @@ async def test_flow_user_unknown_error(hass: HomeAssistant) -> None:
with patch_discord_login() as mock:
mock.side_effect = Exception
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_USER},
data=CONF_DATA,
DOMAIN, context={"source": config_entries.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_INPUT,
)
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"