From 7bb04122390b822dbc1600cc02f6e4479bbdd2d0 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sat, 29 Aug 2026 20:52:47 +0200 Subject: [PATCH] Split the Smarla user flow init from its data (#180665) --- tests/components/smarla/test_config_flow.py | 36 +++++++++++++++------ 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/tests/components/smarla/test_config_flow.py b/tests/components/smarla/test_config_flow.py index 7d39adce2e6b..d144e120a21f 100644 --- a/tests/components/smarla/test_config_flow.py +++ b/tests/components/smarla/test_config_flow.py @@ -52,9 +52,15 @@ async def test_malformed_token(hass: HomeAssistant) -> None: "homeassistant.components.smarla.config_flow.Connection", side_effect=ValueError ): result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_USER}, - data=MOCK_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=MOCK_USER_INPUT, ) assert result["type"] is FlowResultType.FORM @@ -87,9 +93,15 @@ async def test_validation_exception( mock_connection.refresh_token.side_effect = exception result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_USER}, - data=MOCK_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=MOCK_USER_INPUT, ) mock_connection.refresh_token.side_effect = None @@ -114,9 +126,15 @@ async def test_device_exists_abort( mock_config_entry.add_to_hass(hass) result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_USER}, - data=MOCK_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=MOCK_USER_INPUT, ) assert result["type"] is FlowResultType.ABORT