From bf4303829249ef740663e653423cf39780ec3a77 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sat, 29 Aug 2026 20:51:29 +0200 Subject: [PATCH] Split The Things Network user flow init from its data (#180660) --- .../thethingsnetwork/test_config_flow.py | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/components/thethingsnetwork/test_config_flow.py b/tests/components/thethingsnetwork/test_config_flow.py index 99c4a080e177..5525fe322214 100644 --- a/tests/components/thethingsnetwork/test_config_flow.py +++ b/tests/components/thethingsnetwork/test_config_flow.py @@ -28,10 +28,8 @@ async def test_user(hass: HomeAssistant, mock_ttnclient) -> None: assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_USER}, - data=USER_DATA, + result = await hass.config_entries.flow.async_configure( + result["flow_id"], user_input=USER_DATA ) assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == APP_ID @@ -54,17 +52,21 @@ async def test_user_errors( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, - data=USER_DATA, + ) + + 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_DATA ) assert result["type"] is FlowResultType.FORM assert base_error in result["errors"]["base"] # Recover mock_ttnclient.return_value.fetch_data.side_effect = None - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_USER}, - data=USER_DATA, + result = await hass.config_entries.flow.async_configure( + result["flow_id"], user_input=USER_DATA ) assert result["type"] is FlowResultType.CREATE_ENTRY @@ -84,10 +86,8 @@ async def test_duplicate_entry( assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_USER}, - data=USER_DATA, + result = await hass.config_entries.flow.async_configure( + result["flow_id"], user_input=USER_DATA ) assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured"