From 60be1625bf0708adf6f8027d63c6ebfe0ff18830 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sat, 29 Aug 2026 21:16:07 +0200 Subject: [PATCH] Split the Redgtech user flow init from its data (#180681) --- tests/components/redgtech/test_config_flow.py | 36 ++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/tests/components/redgtech/test_config_flow.py b/tests/components/redgtech/test_config_flow.py index 9ca0b9abe7c1..eca3b63fc899 100644 --- a/tests/components/redgtech/test_config_flow.py +++ b/tests/components/redgtech/test_config_flow.py @@ -38,7 +38,14 @@ async def test_user_step_errors( mock_redgtech_api.login.return_value = None result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_USER}, data=user_input + 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=user_input ) assert result["type"] is FlowResultType.FORM @@ -57,7 +64,14 @@ async def test_user_step_creates_entry( mock_redgtech_api.login.side_effect = None result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_USER}, data=user_input + 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=user_input ) assert result["type"] is FlowResultType.CREATE_ENTRY @@ -82,7 +96,14 @@ async def test_user_step_duplicate_entry( user_input = {CONF_EMAIL: TEST_EMAIL, CONF_PASSWORD: TEST_PASSWORD} result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_USER}, data=user_input + 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=user_input ) assert result["type"] is FlowResultType.ABORT @@ -115,7 +136,14 @@ async def test_user_step_error_recovery( # First attempt fails with error mock_redgtech_api.login.side_effect = side_effect result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_USER}, data=user_input + 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=user_input ) assert result["type"] is FlowResultType.FORM