mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
Fix homee test (#148322)
This commit is contained in:
parent
42b50c71ec
commit
0c783e87d1
@ -18,10 +18,18 @@ from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"side_eff",
|
||||
("side_eff", "config_entry_state", "active_flows"),
|
||||
[
|
||||
(
|
||||
HomeeConnectionFailedException("connection timed out"),
|
||||
ConfigEntryState.SETUP_RETRY,
|
||||
[],
|
||||
),
|
||||
(
|
||||
HomeeAuthFailedException("wrong username or password"),
|
||||
ConfigEntryState.SETUP_ERROR,
|
||||
["reauth"],
|
||||
),
|
||||
],
|
||||
)
|
||||
async def test_connection_errors(
|
||||
@ -29,6 +37,8 @@ async def test_connection_errors(
|
||||
mock_homee: MagicMock,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
side_eff: Exception,
|
||||
config_entry_state: ConfigEntryState,
|
||||
active_flows: list[str],
|
||||
) -> None:
|
||||
"""Test if connection errors on startup are handled correctly."""
|
||||
mock_homee.get_access_token.side_effect = side_eff
|
||||
@ -36,7 +46,11 @@ async def test_connection_errors(
|
||||
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
|
||||
assert mock_config_entry.state is ConfigEntryState.SETUP_RETRY
|
||||
assert mock_config_entry.state is config_entry_state
|
||||
|
||||
assert [
|
||||
flow["context"]["source"] for flow in hass.config_entries.flow.async_progress()
|
||||
] == active_flows
|
||||
|
||||
|
||||
async def test_connection_listener(
|
||||
|
Loading…
x
Reference in New Issue
Block a user