mirror of
https://github.com/home-assistant/core.git
synced 2026-07-04 23:51:32 +02:00
recovery error. check
This commit is contained in:
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user