diff --git a/tests/components/fluss/test_config_flow.py b/tests/components/fluss/test_config_flow.py index 883dfa4a019f..d15c7c3803b2 100644 --- a/tests/components/fluss/test_config_flow.py +++ b/tests/components/fluss/test_config_flow.py @@ -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."""