From 54363d31ceb9474e79bc5fe676318e1b2588558b Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sun, 30 Aug 2026 12:26:37 +0200 Subject: [PATCH] Split the Discord user flow init from its data (#180756) --- tests/components/discord/test_config_flow.py | 36 +++++++++++++++----- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/tests/components/discord/test_config_flow.py b/tests/components/discord/test_config_flow.py index e9a1344c5553..04e49a74d82a 100644 --- a/tests/components/discord/test_config_flow.py +++ b/tests/components/discord/test_config_flow.py @@ -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"