From fddd79666b2c88ff7b7f82e36cc6f05cc3ddb8dc Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sat, 29 Aug 2026 21:17:29 +0200 Subject: [PATCH] Split the Pushover user flow init from its data (#180682) --- tests/components/pushover/test_config_flow.py | 36 ++++++++++++++----- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/tests/components/pushover/test_config_flow.py b/tests/components/pushover/test_config_flow.py index a3c9ac3ccbbb..a2989d98a1af 100644 --- a/tests/components/pushover/test_config_flow.py +++ b/tests/components/pushover/test_config_flow.py @@ -102,10 +102,16 @@ async def test_flow_invalid_user_key( mock_pushover.side_effect = BadAPIRequestError("400: user key is invalid") result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": config_entries.SOURCE_USER}, - data=MOCK_CONFIG, + DOMAIN, context={"source": config_entries.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_CONFIG + ) + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {CONF_USER_KEY: "invalid_user_key"} @@ -118,10 +124,16 @@ async def test_flow_invalid_api_key( mock_pushover.side_effect = BadAPIRequestError("400: application token is invalid") result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": config_entries.SOURCE_USER}, - data=MOCK_CONFIG, + DOMAIN, context={"source": config_entries.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_CONFIG + ) + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {CONF_API_KEY: "invalid_api_key"} @@ -132,10 +144,16 @@ async def test_flow_conn_err(hass: HomeAssistant, mock_pushover: MagicMock) -> N mock_pushover.side_effect = BadAPIRequestError result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": config_entries.SOURCE_USER}, - data=MOCK_CONFIG, + DOMAIN, context={"source": config_entries.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_CONFIG + ) + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "cannot_connect"}