mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 00:37:13 +00:00
Make Whirlpool test check for success after failure (#143525)
This commit is contained in:
parent
36081c69e0
commit
e8c4d08b25
@ -196,6 +196,7 @@ async def test_no_appliances_flow(
|
||||
region: tuple[str, Region],
|
||||
brand: tuple[str, Brand],
|
||||
mock_appliances_manager_api: MagicMock,
|
||||
mock_whirlpool_setup_entry: MagicMock,
|
||||
) -> None:
|
||||
"""Test we get an error with no appliances."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
@ -205,6 +206,7 @@ async def test_no_appliances_flow(
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == config_entries.SOURCE_USER
|
||||
|
||||
original_aircons = mock_appliances_manager_api.return_value.aircons
|
||||
mock_appliances_manager_api.return_value.aircons = []
|
||||
mock_appliances_manager_api.return_value.washer_dryers = []
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -214,6 +216,14 @@ async def test_no_appliances_flow(
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "no_appliances"}
|
||||
|
||||
# Test that it succeeds if appliances are found
|
||||
mock_appliances_manager_api.return_value.aircons = original_aircons
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], CONFIG_INPUT | {CONF_REGION: region[0], CONF_BRAND: brand[0]}
|
||||
)
|
||||
|
||||
assert_successful_user_flow(mock_whirlpool_setup_entry, result, region[0], brand[0])
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"mock_auth_api", "mock_appliances_manager_api", "mock_whirlpool_setup_entry"
|
||||
|
Loading…
x
Reference in New Issue
Block a user