recovery error. check

This commit is contained in:
Marcello
2025-10-06 08:47:31 +02:00
parent a6a1b0b85f
commit ca44bc0bc3
@@ -79,6 +79,7 @@ async def test_step_user_errors(
"""Test error cases for user step with recovery."""
user_input: dict[str, Any] = {CONF_API_KEY: "some_api_key"}
# Test error case
with patch(
"fluss_api.FlussApiClient",
side_effect=exception,
@@ -91,6 +92,18 @@ async def test_step_user_errors(
assert result["step_id"] == "user"
assert result["errors"] == {"base": expected_error}
# Test recovery from error
with patch("fluss_api.FlussApiClient") as mock_client:
mock_client.return_value = None
result = await hass.config_entries.flow.async_configure(
result["flow_id"],
user_input={CONF_API_KEY: "valid_api_key"},
)
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["title"] == "My Fluss+ Devices"
assert result["data"] == {"api_key": "valid_api_key"}
async def test_abort_if_already_configured(hass: HomeAssistant) -> None:
"""Test abort if unique ID is already configured."""