From c87c0f04ff2269f64fc6aedfcced48a3ce1ded6d Mon Sep 17 00:00:00 2001 From: Manu Date: Wed, 30 Sep 2026 08:21:15 +0200 Subject: [PATCH] Split user flow init and data submission in airvisual config flow tests (#183653) Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> --- tests/components/airvisual/test_config_flow.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/components/airvisual/test_config_flow.py b/tests/components/airvisual/test_config_flow.py index 632bdb72eb4e..7a0ea674f0a8 100644 --- a/tests/components/airvisual/test_config_flow.py +++ b/tests/components/airvisual/test_config_flow.py @@ -86,8 +86,8 @@ async def test_create_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={"type": integration_type} + result = await hass.config_entries.flow.async_configure( + result["flow_id"], user_input={"type": integration_type} ) assert result["type"] is FlowResultType.FORM assert result["step_id"] == input_form_step @@ -109,7 +109,8 @@ async def test_create_entry( assert result["data"] == {**config, CONF_INTEGRATION_TYPE: integration_type} -async def test_duplicate_error(hass: HomeAssistant, config, setup_config_entry) -> None: +@pytest.mark.usefixtures("setup_config_entry") +async def test_duplicate_error(hass: HomeAssistant, config) -> None: """Test that errors are shown when duplicate entries are added.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} @@ -117,10 +118,8 @@ async def test_duplicate_error(hass: HomeAssistant, config, setup_config_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={"type": INTEGRATION_TYPE_GEOGRAPHY_COORDS}, + result = await hass.config_entries.flow.async_configure( + result["flow_id"], user_input={"type": INTEGRATION_TYPE_GEOGRAPHY_COORDS} ) assert result["type"] is FlowResultType.FORM assert result["step_id"] == "geography_by_coords"