From 287fb7c9505902525ab0c416fa2e0ced72082e35 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Wed, 14 Oct 2026 18:02:11 +0200 Subject: [PATCH] Don't start the Silla Prism user flow with data in tests (#186477) Co-authored-by: Claude --- .../silla_prism/test_config_flow.py | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/tests/components/silla_prism/test_config_flow.py b/tests/components/silla_prism/test_config_flow.py index 8d3dec7f6b60..456d0ccb01df 100644 --- a/tests/components/silla_prism/test_config_flow.py +++ b/tests/components/silla_prism/test_config_flow.py @@ -71,11 +71,12 @@ async def test_user_flow_no_device( hass: HomeAssistant, mqtt_mock: MqttMockHAClient ) -> None: """Test the user flow errors when no traffic is seen, then recovers.""" + result = await hass.config_entries.flow.async_init( + DOMAIN, context={"source": SOURCE_USER} + ) with patch(_PROBE_PATH, return_value=False): - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_USER}, - data={CONF_BASE_TOPIC: BASE_TOPIC}, + result = await hass.config_entries.flow.async_configure( + result["flow_id"], {CONF_BASE_TOPIC: BASE_TOPIC} ) assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "no_device"} @@ -93,11 +94,12 @@ async def test_user_flow_mqtt_unavailable( hass: HomeAssistant, mqtt_mock: MqttMockHAClient ) -> None: """Test the user flow aborts when MQTT is not available.""" + result = await hass.config_entries.flow.async_init( + DOMAIN, context={"source": SOURCE_USER} + ) with patch(_MQTT_CLIENT_PATH, return_value=False): - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_USER}, - data={CONF_BASE_TOPIC: BASE_TOPIC}, + result = await hass.config_entries.flow.async_configure( + result["flow_id"], {CONF_BASE_TOPIC: BASE_TOPIC} ) assert result["type"] is FlowResultType.ABORT assert result["reason"] == "mqtt_unavailable" @@ -113,9 +115,10 @@ async def test_user_flow_invalid_base_topic( ) -> None: """Test the user flow rejects invalid base topics, then recovers.""" result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_USER}, - data={CONF_BASE_TOPIC: base_topic}, + DOMAIN, context={"source": SOURCE_USER} + ) + result = await hass.config_entries.flow.async_configure( + result["flow_id"], {CONF_BASE_TOPIC: base_topic} ) assert result["type"] is FlowResultType.FORM assert result["errors"] == {CONF_BASE_TOPIC: "invalid_base_topic"} @@ -136,9 +139,10 @@ async def test_user_flow_already_configured( ) -> None: """Test the user flow aborts when the base topic is already configured.""" result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_USER}, - data={CONF_BASE_TOPIC: BASE_TOPIC}, + DOMAIN, context={"source": SOURCE_USER} + ) + result = await hass.config_entries.flow.async_configure( + result["flow_id"], {CONF_BASE_TOPIC: BASE_TOPIC} ) assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured"