Split the Pushover user flow init from its data (#180682)

This commit is contained in:
Franck Nijhof
2026-08-29 21:17:29 +02:00
committed by GitHub
parent e2e687b200
commit fddd79666b
+27 -9
View File
@@ -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"}