mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
Sort Home Connect test params (#144035)
This commit is contained in:
parent
92944fa509
commit
79aa7aacec
@ -42,13 +42,13 @@ def platforms() -> list[str]:
|
|||||||
|
|
||||||
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
||||||
async def test_paired_depaired_devices_flow(
|
async def test_paired_depaired_devices_flow(
|
||||||
appliance: HomeAppliance,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
||||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||||
@ -104,14 +104,14 @@ async def test_paired_depaired_devices_flow(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_connected_devices(
|
async def test_connected_devices(
|
||||||
appliance: HomeAppliance,
|
|
||||||
keys_to_check: tuple,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
appliance: HomeAppliance,
|
||||||
|
keys_to_check: tuple,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that devices reconnected.
|
"""Test that devices reconnected.
|
||||||
|
|
||||||
@ -170,9 +170,9 @@ async def test_connected_devices(
|
|||||||
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
||||||
async def test_binary_sensors_entity_availability(
|
async def test_binary_sensors_entity_availability(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test if binary sensor entities availability are based on the appliance connection state."""
|
"""Test if binary sensor entities availability are based on the appliance connection state."""
|
||||||
@ -268,15 +268,15 @@ async def test_binary_sensors_entity_availability(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_binary_sensors_functionality(
|
async def test_binary_sensors_functionality(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
event_key: EventKey,
|
event_key: EventKey,
|
||||||
event_value_update: str,
|
event_value_update: str,
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
expected: str,
|
expected: str,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Tests for Home Connect Fridge appliance door states."""
|
"""Tests for Home Connect Fridge appliance door states."""
|
||||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||||
@ -309,9 +309,9 @@ async def test_binary_sensors_functionality(
|
|||||||
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
||||||
async def test_connected_sensor_functionality(
|
async def test_connected_sensor_functionality(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test if the connected binary sensor reports the right values."""
|
"""Test if the connected binary sensor reports the right values."""
|
||||||
|
@ -34,13 +34,13 @@ def platforms() -> list[str]:
|
|||||||
|
|
||||||
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
||||||
async def test_paired_depaired_devices_flow(
|
async def test_paired_depaired_devices_flow(
|
||||||
appliance: HomeAppliance,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
||||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||||
@ -96,14 +96,14 @@ async def test_paired_depaired_devices_flow(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_connected_devices(
|
async def test_connected_devices(
|
||||||
appliance: HomeAppliance,
|
|
||||||
keys_to_check: tuple,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
appliance: HomeAppliance,
|
||||||
|
keys_to_check: tuple,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that devices reconnected.
|
"""Test that devices reconnected.
|
||||||
|
|
||||||
@ -173,9 +173,9 @@ async def test_connected_devices(
|
|||||||
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
||||||
async def test_button_entity_availability(
|
async def test_button_entity_availability(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test if button entities availability are based on the appliance connection state."""
|
"""Test if button entities availability are based on the appliance connection state."""
|
||||||
@ -237,9 +237,9 @@ async def test_button_entity_availability(
|
|||||||
)
|
)
|
||||||
async def test_button_functionality(
|
async def test_button_functionality(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
method_call: str,
|
method_call: str,
|
||||||
expected_kwargs: dict[str, Any],
|
expected_kwargs: dict[str, Any],
|
||||||
@ -265,9 +265,9 @@ async def test_button_functionality(
|
|||||||
|
|
||||||
async def test_command_button_exception(
|
async def test_command_button_exception(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client_with_exception: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client_with_exception: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test if button entities availability are based on the appliance connection state."""
|
"""Test if button entities availability are based on the appliance connection state."""
|
||||||
entity_id = "button.washer_pause_program"
|
entity_id = "button.washer_pause_program"
|
||||||
@ -301,9 +301,9 @@ async def test_command_button_exception(
|
|||||||
|
|
||||||
async def test_stop_program_button_exception(
|
async def test_stop_program_button_exception(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client_with_exception: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client_with_exception: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test if button entities availability are based on the appliance connection state."""
|
"""Test if button entities availability are based on the appliance connection state."""
|
||||||
entity_id = "button.washer_stop_program"
|
entity_id = "button.washer_stop_program"
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
"""Test the Home Connect config flow."""
|
"""Test the Home Connect config flow."""
|
||||||
|
|
||||||
from collections.abc import Awaitable, Callable
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from aiohomeconnect.const import OAUTH2_AUTHORIZE, OAUTH2_TOKEN
|
from aiohomeconnect.const import OAUTH2_AUTHORIZE, OAUTH2_TOKEN
|
||||||
import pytest
|
import pytest
|
||||||
@ -143,13 +142,13 @@ async def test_prevent_reconfiguring_same_account(
|
|||||||
@pytest.mark.usefixtures("current_request_with_host")
|
@pytest.mark.usefixtures("current_request_with_host")
|
||||||
async def test_reauth_flow(
|
async def test_reauth_flow(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
hass_client_no_auth: ClientSessionGenerator,
|
hass_client_no_auth: ClientSessionGenerator,
|
||||||
aioclient_mock: AiohttpClientMocker,
|
aioclient_mock: AiohttpClientMocker,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test reauth flow."""
|
"""Test reauth flow."""
|
||||||
|
config_entry.add_to_hass(hass)
|
||||||
|
|
||||||
result = await config_entry.start_reauth_flow(hass)
|
result = await config_entry.start_reauth_flow(hass)
|
||||||
|
|
||||||
assert result["type"] is FlowResultType.FORM
|
assert result["type"] is FlowResultType.FORM
|
||||||
@ -197,13 +196,13 @@ async def test_reauth_flow(
|
|||||||
@pytest.mark.usefixtures("current_request_with_host")
|
@pytest.mark.usefixtures("current_request_with_host")
|
||||||
async def test_reauth_flow_with_different_account(
|
async def test_reauth_flow_with_different_account(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
hass_client_no_auth: ClientSessionGenerator,
|
hass_client_no_auth: ClientSessionGenerator,
|
||||||
aioclient_mock: AiohttpClientMocker,
|
aioclient_mock: AiohttpClientMocker,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test reauth flow."""
|
"""Test reauth flow."""
|
||||||
|
config_entry.add_to_hass(hass)
|
||||||
|
|
||||||
result = await config_entry.start_reauth_flow(hass)
|
result = await config_entry.start_reauth_flow(hass)
|
||||||
|
|
||||||
assert result["type"] is FlowResultType.FORM
|
assert result["type"] is FlowResultType.FORM
|
||||||
|
@ -83,10 +83,10 @@ def platforms() -> list[str]:
|
|||||||
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
||||||
async def test_coordinator_failure_refresh_and_stream(
|
async def test_coordinator_failure_refresh_and_stream(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
freezer: FrozenDateTimeFactory,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
freezer: FrozenDateTimeFactory,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test entity available state via coordinator refresh and event stream."""
|
"""Test entity available state via coordinator refresh and event stream."""
|
||||||
@ -210,9 +210,9 @@ async def test_coordinator_failure_refresh_and_stream(
|
|||||||
indirect=True,
|
indirect=True,
|
||||||
)
|
)
|
||||||
async def test_coordinator_not_fetching_on_disconnected_appliance(
|
async def test_coordinator_not_fetching_on_disconnected_appliance(
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that the coordinator does not fetch anything on disconnected appliance."""
|
"""Test that the coordinator does not fetch anything on disconnected appliance."""
|
||||||
@ -231,10 +231,10 @@ async def test_coordinator_not_fetching_on_disconnected_appliance(
|
|||||||
INITIAL_FETCH_CLIENT_METHODS,
|
INITIAL_FETCH_CLIENT_METHODS,
|
||||||
)
|
)
|
||||||
async def test_coordinator_update_failing(
|
async def test_coordinator_update_failing(
|
||||||
mock_method: str,
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
mock_method: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that although is not possible to get settings and status, the config entry is loaded.
|
"""Test that although is not possible to get settings and status, the config entry is loaded.
|
||||||
|
|
||||||
@ -274,16 +274,16 @@ async def test_coordinator_update_failing(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_event_listener(
|
async def test_event_listener(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
appliance: HomeAppliance,
|
||||||
event_type: EventType,
|
event_type: EventType,
|
||||||
event_key: EventKey,
|
event_key: EventKey,
|
||||||
event_value: str,
|
event_value: str,
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
|
||||||
entity_registry: er.EntityRegistry,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that the event listener works."""
|
"""Test that the event listener works."""
|
||||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||||
@ -344,9 +344,9 @@ async def test_event_listener(
|
|||||||
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
||||||
async def tests_receive_setting_and_status_for_first_time_at_events(
|
async def tests_receive_setting_and_status_for_first_time_at_events(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that the event listener is capable of receiving settings and status for the first time."""
|
"""Test that the event listener is capable of receiving settings and status for the first time."""
|
||||||
@ -400,9 +400,9 @@ async def tests_receive_setting_and_status_for_first_time_at_events(
|
|||||||
|
|
||||||
async def test_event_listener_error(
|
async def test_event_listener_error(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client_with_exception: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client_with_exception: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that the configuration entry is reloaded when the event stream raises an API error."""
|
"""Test that the configuration entry is reloaded when the event stream raises an API error."""
|
||||||
client_with_exception.stream_all_events = MagicMock(
|
client_with_exception.stream_all_events = MagicMock(
|
||||||
@ -446,17 +446,17 @@ async def test_event_listener_error(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_event_listener_resilience(
|
async def test_event_listener_resilience(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
appliance: HomeAppliance,
|
||||||
|
exception: HomeConnectError,
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
initial_state: str,
|
initial_state: str,
|
||||||
event_key: EventKey,
|
event_key: EventKey,
|
||||||
event_value: Any,
|
event_value: Any,
|
||||||
after_event_expected_state: str,
|
after_event_expected_state: str,
|
||||||
exception: HomeConnectError,
|
|
||||||
hass: HomeAssistant,
|
|
||||||
appliance: HomeAppliance,
|
|
||||||
client: MagicMock,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that the event listener is resilient to interruptions."""
|
"""Test that the event listener is resilient to interruptions."""
|
||||||
future = hass.loop.create_future()
|
future = hass.loop.create_future()
|
||||||
@ -516,10 +516,10 @@ async def test_event_listener_resilience(
|
|||||||
|
|
||||||
async def test_devices_updated_on_refresh(
|
async def test_devices_updated_on_refresh(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
device_registry: dr.DeviceRegistry,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
device_registry: dr.DeviceRegistry,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test handling of devices added or deleted while event stream is down."""
|
"""Test handling of devices added or deleted while event stream is down."""
|
||||||
appliances: list[HomeAppliance] = (
|
appliances: list[HomeAppliance] = (
|
||||||
@ -557,9 +557,9 @@ async def test_devices_updated_on_refresh(
|
|||||||
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
||||||
async def test_paired_disconnected_devices_not_fetching(
|
async def test_paired_disconnected_devices_not_fetching(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that Home Connect API is not fetched after pairing a disconnected device."""
|
"""Test that Home Connect API is not fetched after pairing a disconnected device."""
|
||||||
@ -587,11 +587,11 @@ async def test_paired_disconnected_devices_not_fetching(
|
|||||||
|
|
||||||
async def test_coordinator_disabling_updates_for_appliance(
|
async def test_coordinator_disabling_updates_for_appliance(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
hass_client: ClientSessionGenerator,
|
||||||
|
issue_registry: ir.IssueRegistry,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
issue_registry: ir.IssueRegistry,
|
|
||||||
hass_client: ClientSessionGenerator,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test coordinator disables appliance updates on frequent connect/paired events.
|
"""Test coordinator disables appliance updates on frequent connect/paired events.
|
||||||
|
|
||||||
@ -680,11 +680,10 @@ async def test_coordinator_disabling_updates_for_appliance(
|
|||||||
|
|
||||||
async def test_coordinator_disabling_updates_for_appliance_is_gone_after_entry_reload(
|
async def test_coordinator_disabling_updates_for_appliance_is_gone_after_entry_reload(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
issue_registry: ir.IssueRegistry,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
issue_registry: ir.IssueRegistry,
|
|
||||||
hass_client: ClientSessionGenerator,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that updates are enabled again after unloading the entry.
|
"""Test that updates are enabled again after unloading the entry.
|
||||||
|
|
||||||
|
@ -19,9 +19,9 @@ from tests.common import MockConfigEntry
|
|||||||
|
|
||||||
async def test_async_get_config_entry_diagnostics(
|
async def test_async_get_config_entry_diagnostics(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
snapshot: SnapshotAssertion,
|
snapshot: SnapshotAssertion,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test config entry diagnostics."""
|
"""Test config entry diagnostics."""
|
||||||
@ -34,10 +34,10 @@ async def test_async_get_config_entry_diagnostics(
|
|||||||
|
|
||||||
async def test_async_get_device_diagnostics(
|
async def test_async_get_device_diagnostics(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
device_registry: dr.DeviceRegistry,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
device_registry: dr.DeviceRegistry,
|
|
||||||
snapshot: SnapshotAssertion,
|
snapshot: SnapshotAssertion,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test device config entry diagnostics."""
|
"""Test device config entry diagnostics."""
|
||||||
|
@ -95,6 +95,10 @@ def platforms() -> list[str]:
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_program_options_retrieval(
|
async def test_program_options_retrieval(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
array_of_programs_program_arg: str,
|
array_of_programs_program_arg: str,
|
||||||
event_key: EventKey,
|
event_key: EventKey,
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
@ -103,10 +107,6 @@ async def test_program_options_retrieval(
|
|||||||
options_availability_stage_2: list[bool],
|
options_availability_stage_2: list[bool],
|
||||||
option_without_default: tuple[OptionKey, str],
|
option_without_default: tuple[OptionKey, str],
|
||||||
option_without_constraints: tuple[OptionKey, str],
|
option_without_constraints: tuple[OptionKey, str],
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that the options are correctly retrieved at the start and updated on program updates."""
|
"""Test that the options are correctly retrieved at the start and updated on program updates."""
|
||||||
original_get_all_programs_mock = client.get_all_programs.side_effect
|
original_get_all_programs_mock = client.get_all_programs.side_effect
|
||||||
@ -250,13 +250,13 @@ async def test_program_options_retrieval(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_no_options_retrieval_on_unknown_program(
|
async def test_no_options_retrieval_on_unknown_program(
|
||||||
array_of_programs_program_arg: str,
|
|
||||||
event_key: EventKey,
|
|
||||||
appliance: HomeAppliance,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
appliance: HomeAppliance,
|
||||||
|
array_of_programs_program_arg: str,
|
||||||
|
event_key: EventKey,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that no options are retrieved when the program is unknown."""
|
"""Test that no options are retrieved when the program is unknown."""
|
||||||
|
|
||||||
@ -326,14 +326,14 @@ async def test_no_options_retrieval_on_unknown_program(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_program_options_retrieval_after_appliance_connection(
|
async def test_program_options_retrieval_after_appliance_connection(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
event_key: EventKey,
|
event_key: EventKey,
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
option_key: OptionKey,
|
option_key: OptionKey,
|
||||||
option_entity_id: str,
|
option_entity_id: str,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that the options are correctly retrieved at the start and updated on program updates."""
|
"""Test that the options are correctly retrieved at the start and updated on program updates."""
|
||||||
array_of_home_appliances = client.get_home_appliances.return_value
|
array_of_home_appliances = client.get_home_appliances.return_value
|
||||||
@ -447,12 +447,12 @@ async def test_program_options_retrieval_after_appliance_connection(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_option_entity_functionality_exception(
|
async def test_option_entity_functionality_exception(
|
||||||
set_active_program_option_side_effect: HomeConnectError | None,
|
|
||||||
set_selected_program_option_side_effect: HomeConnectError | None,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
set_active_program_option_side_effect: HomeConnectError | None,
|
||||||
|
set_selected_program_option_side_effect: HomeConnectError | None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that the option entity handles exceptions correctly."""
|
"""Test that the option entity handles exceptions correctly."""
|
||||||
entity_id = "switch.washer_i_dos_1_active"
|
entity_id = "switch.washer_i_dos_1_active"
|
||||||
|
@ -41,9 +41,9 @@ from tests.test_util.aiohttp import AiohttpClientMocker
|
|||||||
|
|
||||||
async def test_entry_setup(
|
async def test_entry_setup(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test setup and unload."""
|
"""Test setup and unload."""
|
||||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||||
@ -59,11 +59,11 @@ async def test_entry_setup(
|
|||||||
@pytest.mark.parametrize("token_expiration_time", [12345])
|
@pytest.mark.parametrize("token_expiration_time", [12345])
|
||||||
async def test_token_refresh_success(
|
async def test_token_refresh_success(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
platforms: list[Platform],
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
aioclient_mock: AiohttpClientMocker,
|
aioclient_mock: AiohttpClientMocker,
|
||||||
client: MagicMock,
|
client: MagicMock,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
platforms: list[Platform],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test where token is expired and the refresh attempt succeeds."""
|
"""Test where token is expired and the refresh attempt succeeds."""
|
||||||
|
|
||||||
@ -138,14 +138,13 @@ async def test_token_refresh_success(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_token_refresh_error(
|
async def test_token_refresh_error(
|
||||||
aioclient_mock_args: dict[str, Any],
|
|
||||||
expected_config_entry_state: ConfigEntryState,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
platforms: list[Platform],
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
aioclient_mock: AiohttpClientMocker,
|
aioclient_mock: AiohttpClientMocker,
|
||||||
client: MagicMock,
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
aioclient_mock_args: dict[str, Any],
|
||||||
|
expected_config_entry_state: ConfigEntryState,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test where token is expired and the refresh attempt fails."""
|
"""Test where token is expired and the refresh attempt fails."""
|
||||||
|
|
||||||
@ -174,11 +173,11 @@ async def test_token_refresh_error(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_client_error(
|
async def test_client_error(
|
||||||
exception: HomeConnectError,
|
client_with_exception: MagicMock,
|
||||||
expected_state: ConfigEntryState,
|
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client_with_exception: MagicMock,
|
exception: HomeConnectError,
|
||||||
|
expected_state: ConfigEntryState,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test client errors during setup integration."""
|
"""Test client errors during setup integration."""
|
||||||
client_with_exception.get_home_appliances.return_value = None
|
client_with_exception.get_home_appliances.return_value = None
|
||||||
@ -200,11 +199,10 @@ async def test_client_error(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_client_rate_limit_error(
|
async def test_client_rate_limit_error(
|
||||||
raising_exception_method: str,
|
client: MagicMock,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
raising_exception_method: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test client errors during setup integration."""
|
"""Test client errors during setup integration."""
|
||||||
retry_after = 42
|
retry_after = 42
|
||||||
@ -234,9 +232,9 @@ async def test_client_rate_limit_error(
|
|||||||
async def test_required_program_or_at_least_an_option(
|
async def test_required_program_or_at_least_an_option(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"Test that the set_program_and_options does raise an exception if no program nor options are set."
|
"Test that the set_program_and_options does raise an exception if no program nor options are set."
|
||||||
@ -270,8 +268,8 @@ async def test_entity_migration(
|
|||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
config_entry_v1_1: MockConfigEntry,
|
config_entry_v1_1: MockConfigEntry,
|
||||||
appliance: HomeAppliance,
|
|
||||||
platforms: list[Platform],
|
platforms: list[Platform],
|
||||||
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test entity migration."""
|
"""Test entity migration."""
|
||||||
|
|
||||||
|
@ -55,13 +55,13 @@ def platforms() -> list[str]:
|
|||||||
|
|
||||||
@pytest.mark.parametrize("appliance", ["Hood"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Hood"], indirect=True)
|
||||||
async def test_paired_depaired_devices_flow(
|
async def test_paired_depaired_devices_flow(
|
||||||
appliance: HomeAppliance,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
||||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||||
@ -117,14 +117,14 @@ async def test_paired_depaired_devices_flow(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_connected_devices(
|
async def test_connected_devices(
|
||||||
appliance: HomeAppliance,
|
|
||||||
keys_to_check: tuple,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
appliance: HomeAppliance,
|
||||||
|
keys_to_check: tuple,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that devices reconnected.
|
"""Test that devices reconnected.
|
||||||
|
|
||||||
@ -177,9 +177,9 @@ async def test_connected_devices(
|
|||||||
@pytest.mark.parametrize("appliance", ["Hood"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Hood"], indirect=True)
|
||||||
async def test_light_availability(
|
async def test_light_availability(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test if light entities availability are based on the appliance connection state."""
|
"""Test if light entities availability are based on the appliance connection state."""
|
||||||
@ -341,16 +341,16 @@ async def test_light_availability(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_light_functionality(
|
async def test_light_functionality(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
set_settings_args: dict[SettingKey, Any],
|
set_settings_args: dict[SettingKey, Any],
|
||||||
service: str,
|
service: str,
|
||||||
exprected_attributes: dict[str, Any],
|
exprected_attributes: dict[str, Any],
|
||||||
state: str,
|
state: str,
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test light functionality."""
|
"""Test light functionality."""
|
||||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||||
@ -396,13 +396,13 @@ async def test_light_functionality(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_light_color_different_than_custom(
|
async def test_light_color_different_than_custom(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
events: dict[EventKey, Any],
|
events: dict[EventKey, Any],
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that light color attributes are not set if color is different than custom."""
|
"""Test that light color attributes are not set if color is different than custom."""
|
||||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||||
@ -560,16 +560,16 @@ async def test_light_color_different_than_custom(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_light_exception_handling(
|
async def test_light_exception_handling(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client_with_exception: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
setting: dict[SettingKey, dict[str, Any]],
|
setting: dict[SettingKey, dict[str, Any]],
|
||||||
service: str,
|
service: str,
|
||||||
service_data: dict,
|
service_data: dict,
|
||||||
attr_side_effect: list[type[HomeConnectError] | None],
|
attr_side_effect: list[type[HomeConnectError] | None],
|
||||||
exception_match: str,
|
exception_match: str,
|
||||||
hass: HomeAssistant,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
client_with_exception: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test light exception handling."""
|
"""Test light exception handling."""
|
||||||
client_with_exception.get_settings.side_effect = None
|
client_with_exception.get_settings.side_effect = None
|
||||||
|
@ -60,13 +60,13 @@ def platforms() -> list[str]:
|
|||||||
|
|
||||||
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
||||||
async def test_paired_depaired_devices_flow(
|
async def test_paired_depaired_devices_flow(
|
||||||
appliance: HomeAppliance,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
|
device_registry: dr.DeviceRegistry,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
appliance: HomeAppliance,
|
||||||
device_registry: dr.DeviceRegistry,
|
|
||||||
entity_registry: er.EntityRegistry,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
||||||
client.get_available_program = AsyncMock(
|
client.get_available_program = AsyncMock(
|
||||||
@ -135,14 +135,14 @@ async def test_paired_depaired_devices_flow(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_connected_devices(
|
async def test_connected_devices(
|
||||||
appliance: HomeAppliance,
|
|
||||||
keys_to_check: tuple,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
appliance: HomeAppliance,
|
||||||
|
keys_to_check: tuple,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that devices reconnected.
|
"""Test that devices reconnected.
|
||||||
|
|
||||||
@ -195,9 +195,9 @@ async def test_connected_devices(
|
|||||||
@pytest.mark.parametrize("appliance", ["FridgeFreezer"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["FridgeFreezer"], indirect=True)
|
||||||
async def test_number_entity_availability(
|
async def test_number_entity_availability(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test if number entities availability are based on the appliance connection state."""
|
"""Test if number entities availability are based on the appliance connection state."""
|
||||||
@ -285,6 +285,10 @@ async def test_number_entity_availability(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_number_entity_functionality(
|
async def test_number_entity_functionality(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
setting_key: SettingKey,
|
setting_key: SettingKey,
|
||||||
@ -294,10 +298,6 @@ async def test_number_entity_functionality(
|
|||||||
max_value: int,
|
max_value: int,
|
||||||
step_size: float,
|
step_size: float,
|
||||||
unit_of_measurement: str,
|
unit_of_measurement: str,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test number entity functionality."""
|
"""Test number entity functionality."""
|
||||||
client.get_setting.side_effect = None
|
client.get_setting.side_effect = None
|
||||||
@ -372,6 +372,10 @@ async def test_number_entity_functionality(
|
|||||||
)
|
)
|
||||||
@patch("homeassistant.components.home_connect.entity.API_DEFAULT_RETRY_AFTER", new=0)
|
@patch("homeassistant.components.home_connect.entity.API_DEFAULT_RETRY_AFTER", new=0)
|
||||||
async def test_fetch_constraints_after_rate_limit_error(
|
async def test_fetch_constraints_after_rate_limit_error(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
retry_after: int | None,
|
retry_after: int | None,
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
@ -381,10 +385,6 @@ async def test_fetch_constraints_after_rate_limit_error(
|
|||||||
max_value: int,
|
max_value: int,
|
||||||
step_size: int,
|
step_size: int,
|
||||||
unit_of_measurement: str,
|
unit_of_measurement: str,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that, if a API rate limit error is raised, the constraints are fetched later."""
|
"""Test that, if a API rate limit error is raised, the constraints are fetched later."""
|
||||||
|
|
||||||
@ -448,13 +448,13 @@ async def test_fetch_constraints_after_rate_limit_error(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_number_entity_error(
|
async def test_number_entity_error(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client_with_exception: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
setting_key: SettingKey,
|
setting_key: SettingKey,
|
||||||
mock_attr: str,
|
mock_attr: str,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client_with_exception: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test number entity error."""
|
"""Test number entity error."""
|
||||||
client_with_exception.get_settings.side_effect = None
|
client_with_exception.get_settings.side_effect = None
|
||||||
@ -529,6 +529,10 @@ async def test_number_entity_error(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_options_functionality(
|
async def test_options_functionality(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
option_key: OptionKey,
|
option_key: OptionKey,
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
@ -539,10 +543,6 @@ async def test_options_functionality(
|
|||||||
set_active_program_options_side_effect: ActiveProgramNotSetError | None,
|
set_active_program_options_side_effect: ActiveProgramNotSetError | None,
|
||||||
set_selected_program_options_side_effect: SelectedProgramNotSetError | None,
|
set_selected_program_options_side_effect: SelectedProgramNotSetError | None,
|
||||||
called_mock_method: str,
|
called_mock_method: str,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test options functionality."""
|
"""Test options functionality."""
|
||||||
|
|
||||||
|
@ -64,13 +64,13 @@ def platforms() -> list[str]:
|
|||||||
|
|
||||||
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
||||||
async def test_paired_depaired_devices_flow(
|
async def test_paired_depaired_devices_flow(
|
||||||
appliance: HomeAppliance,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
||||||
client.get_available_program = AsyncMock(
|
client.get_available_program = AsyncMock(
|
||||||
@ -141,14 +141,14 @@ async def test_paired_depaired_devices_flow(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_connected_devices(
|
async def test_connected_devices(
|
||||||
appliance: HomeAppliance,
|
|
||||||
keys_to_check: tuple,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
appliance: HomeAppliance,
|
||||||
|
keys_to_check: tuple,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that devices reconnected.
|
"""Test that devices reconnected.
|
||||||
|
|
||||||
@ -211,9 +211,9 @@ async def test_connected_devices(
|
|||||||
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
||||||
async def test_select_entity_availability(
|
async def test_select_entity_availability(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test if select entities availability are based on the appliance connection state."""
|
"""Test if select entities availability are based on the appliance connection state."""
|
||||||
@ -261,10 +261,10 @@ async def test_select_entity_availability(
|
|||||||
|
|
||||||
|
|
||||||
async def test_filter_programs(
|
async def test_filter_programs(
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
entity_registry: er.EntityRegistry,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test select that only right programs are shown."""
|
"""Test select that only right programs are shown."""
|
||||||
client.get_all_programs.side_effect = None
|
client.get_all_programs.side_effect = None
|
||||||
@ -352,6 +352,10 @@ async def test_filter_programs(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_select_program_functionality(
|
async def test_select_program_functionality(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
expected_initial_state: str,
|
expected_initial_state: str,
|
||||||
@ -359,10 +363,6 @@ async def test_select_program_functionality(
|
|||||||
program_key: ProgramKey,
|
program_key: ProgramKey,
|
||||||
program_to_set: str,
|
program_to_set: str,
|
||||||
event_key: EventKey,
|
event_key: EventKey,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test select functionality."""
|
"""Test select functionality."""
|
||||||
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
||||||
@ -428,14 +428,14 @@ async def test_select_program_functionality(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_select_exception_handling(
|
async def test_select_exception_handling(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client_with_exception: MagicMock,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
program_to_set: str,
|
program_to_set: str,
|
||||||
mock_attr: str,
|
mock_attr: str,
|
||||||
exception_match: str,
|
exception_match: str,
|
||||||
hass: HomeAssistant,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
client_with_exception: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test exception handling."""
|
"""Test exception handling."""
|
||||||
client_with_exception.get_all_programs.side_effect = None
|
client_with_exception.get_all_programs.side_effect = None
|
||||||
@ -470,11 +470,11 @@ async def test_select_exception_handling(
|
|||||||
|
|
||||||
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
||||||
async def test_programs_updated_on_connect(
|
async def test_programs_updated_on_connect(
|
||||||
appliance: HomeAppliance,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that devices reconnected.
|
"""Test that devices reconnected.
|
||||||
|
|
||||||
@ -554,16 +554,16 @@ async def test_programs_updated_on_connect(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_select_functionality(
|
async def test_select_functionality(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
setting_key: SettingKey,
|
setting_key: SettingKey,
|
||||||
expected_options: set[str],
|
expected_options: set[str],
|
||||||
value_to_set: str,
|
value_to_set: str,
|
||||||
expected_value_call_arg: str,
|
expected_value_call_arg: str,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test select functionality."""
|
"""Test select functionality."""
|
||||||
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
||||||
@ -617,15 +617,15 @@ async def test_select_functionality(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_fetch_allowed_values(
|
async def test_fetch_allowed_values(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
test_setting_key: SettingKey,
|
test_setting_key: SettingKey,
|
||||||
allowed_values: list[str | None],
|
allowed_values: list[str | None],
|
||||||
expected_options: set[str],
|
expected_options: set[str],
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test fetch allowed values."""
|
"""Test fetch allowed values."""
|
||||||
original_get_setting_side_effect = client.get_setting
|
original_get_setting_side_effect = client.get_setting
|
||||||
@ -673,15 +673,15 @@ async def test_fetch_allowed_values(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_fetch_allowed_values_after_rate_limit_error(
|
async def test_fetch_allowed_values_after_rate_limit_error(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
setting_key: SettingKey,
|
setting_key: SettingKey,
|
||||||
allowed_values: list[str | None],
|
allowed_values: list[str | None],
|
||||||
expected_options: set[str],
|
expected_options: set[str],
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test fetch allowed values."""
|
"""Test fetch allowed values."""
|
||||||
|
|
||||||
@ -747,15 +747,15 @@ async def test_fetch_allowed_values_after_rate_limit_error(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_default_values_after_fetch_allowed_values_error(
|
async def test_default_values_after_fetch_allowed_values_error(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
setting_key: SettingKey,
|
setting_key: SettingKey,
|
||||||
exception: Exception,
|
exception: Exception,
|
||||||
expected_options: set[str],
|
expected_options: set[str],
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test fetch allowed values."""
|
"""Test fetch allowed values."""
|
||||||
|
|
||||||
@ -799,15 +799,15 @@ async def test_default_values_after_fetch_allowed_values_error(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_select_entity_error(
|
async def test_select_entity_error(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client_with_exception: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
setting_key: SettingKey,
|
setting_key: SettingKey,
|
||||||
allowed_value: str,
|
allowed_value: str,
|
||||||
value_to_set: str,
|
value_to_set: str,
|
||||||
mock_attr: str,
|
mock_attr: str,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client_with_exception: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test select entity error."""
|
"""Test select entity error."""
|
||||||
client_with_exception.get_settings.side_effect = None
|
client_with_exception.get_settings.side_effect = None
|
||||||
@ -913,6 +913,10 @@ async def test_select_entity_error(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_options_functionality(
|
async def test_options_functionality(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
option_key: OptionKey,
|
option_key: OptionKey,
|
||||||
allowed_values: list[str | None] | None,
|
allowed_values: list[str | None] | None,
|
||||||
@ -921,10 +925,6 @@ async def test_options_functionality(
|
|||||||
set_active_program_options_side_effect: ActiveProgramNotSetError | None,
|
set_active_program_options_side_effect: ActiveProgramNotSetError | None,
|
||||||
set_selected_program_options_side_effect: SelectedProgramNotSetError | None,
|
set_selected_program_options_side_effect: SelectedProgramNotSetError | None,
|
||||||
called_mock_method: str,
|
called_mock_method: str,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test options functionality."""
|
"""Test options functionality."""
|
||||||
if set_active_program_options_side_effect:
|
if set_active_program_options_side_effect:
|
||||||
|
@ -91,13 +91,13 @@ def platforms() -> list[str]:
|
|||||||
|
|
||||||
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
||||||
async def test_paired_depaired_devices_flow(
|
async def test_paired_depaired_devices_flow(
|
||||||
appliance: HomeAppliance,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
||||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||||
@ -176,14 +176,14 @@ async def test_paired_depaired_devices_flow(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_connected_devices(
|
async def test_connected_devices(
|
||||||
appliance: HomeAppliance,
|
|
||||||
keys_to_check: tuple,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
appliance: HomeAppliance,
|
||||||
|
keys_to_check: tuple,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that devices reconnected.
|
"""Test that devices reconnected.
|
||||||
|
|
||||||
@ -236,9 +236,9 @@ async def test_connected_devices(
|
|||||||
@pytest.mark.parametrize("appliance", [TEST_HC_APP], indirect=True)
|
@pytest.mark.parametrize("appliance", [TEST_HC_APP], indirect=True)
|
||||||
async def test_sensor_entity_availability(
|
async def test_sensor_entity_availability(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test if sensor entities availability are based on the appliance connection state."""
|
"""Test if sensor entities availability are based on the appliance connection state."""
|
||||||
@ -355,14 +355,14 @@ ENTITY_ID_STATES = {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
async def test_program_sensors(
|
async def test_program_sensors(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
freezer: FrozenDateTimeFactory,
|
||||||
client: MagicMock,
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
states: tuple,
|
states: tuple,
|
||||||
event_run: dict[EventType, dict[EventKey, str | int]],
|
event_run: dict[EventType, dict[EventKey, str | int]],
|
||||||
freezer: FrozenDateTimeFactory,
|
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test sequence for sensors that expose information about a program."""
|
"""Test sequence for sensors that expose information about a program."""
|
||||||
entity_ids = ENTITY_ID_STATES.keys()
|
entity_ids = ENTITY_ID_STATES.keys()
|
||||||
@ -428,15 +428,15 @@ async def test_program_sensors(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_program_sensor_edge_case(
|
async def test_program_sensor_edge_case(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
initial_operation_state: str,
|
initial_operation_state: str,
|
||||||
initial_state: str,
|
initial_state: str,
|
||||||
event_order: tuple[EventType, EventType],
|
event_order: tuple[EventType, EventType],
|
||||||
entity_states: tuple[str, str],
|
entity_states: tuple[str, str],
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test edge case for the program related entities."""
|
"""Test edge case for the program related entities."""
|
||||||
entity_id = "sensor.dishwasher_program_progress"
|
entity_id = "sensor.dishwasher_program_progress"
|
||||||
@ -503,12 +503,12 @@ ENTITY_ID_EDGE_CASE_STATES = [
|
|||||||
|
|
||||||
@pytest.mark.parametrize("appliance", [TEST_HC_APP], indirect=True)
|
@pytest.mark.parametrize("appliance", [TEST_HC_APP], indirect=True)
|
||||||
async def test_remaining_prog_time_edge_cases(
|
async def test_remaining_prog_time_edge_cases(
|
||||||
appliance: HomeAppliance,
|
|
||||||
freezer: FrozenDateTimeFactory,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
freezer: FrozenDateTimeFactory,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Run program sequence to test edge cases for the remaining_prog_time entity."""
|
"""Run program sequence to test edge cases for the remaining_prog_time entity."""
|
||||||
entity_id = "sensor.dishwasher_program_finish_time"
|
entity_id = "sensor.dishwasher_program_finish_time"
|
||||||
@ -581,14 +581,14 @@ async def test_remaining_prog_time_edge_cases(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_sensors_states(
|
async def test_sensors_states(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
event_key: EventKey,
|
event_key: EventKey,
|
||||||
value_expected_state: list[tuple[str, str]],
|
value_expected_state: list[tuple[str, str]],
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Tests for appliance sensors."""
|
"""Tests for appliance sensors."""
|
||||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||||
@ -641,15 +641,15 @@ async def test_sensors_states(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_event_sensors_states(
|
async def test_event_sensors_states(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
caplog: pytest.LogCaptureFixture,
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
event_key: EventKey,
|
event_key: EventKey,
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
entity_registry: er.EntityRegistry,
|
|
||||||
caplog: pytest.LogCaptureFixture,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Tests for appliance event sensors."""
|
"""Tests for appliance event sensors."""
|
||||||
caplog.set_level(logging.ERROR)
|
caplog.set_level(logging.ERROR)
|
||||||
@ -726,16 +726,16 @@ async def test_event_sensors_states(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_sensor_unit_fetching(
|
async def test_sensor_unit_fetching(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
status_key: StatusKey,
|
status_key: StatusKey,
|
||||||
unit_get_status: str | None,
|
unit_get_status: str | None,
|
||||||
unit_get_status_value: str | None,
|
unit_get_status_value: str | None,
|
||||||
get_status_value_call_count: int,
|
get_status_value_call_count: int,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that the sensor entities are capable of fetching units."""
|
"""Test that the sensor entities are capable of fetching units."""
|
||||||
|
|
||||||
@ -793,13 +793,13 @@ async def test_sensor_unit_fetching(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_sensor_unit_fetching_error(
|
async def test_sensor_unit_fetching_error(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
status_key: StatusKey,
|
status_key: StatusKey,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that the sensor entities are capable of fetching units."""
|
"""Test that the sensor entities are capable of fetching units."""
|
||||||
|
|
||||||
@ -844,14 +844,14 @@ async def test_sensor_unit_fetching_error(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_sensor_unit_fetching_after_rate_limit_error(
|
async def test_sensor_unit_fetching_after_rate_limit_error(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
status_key: StatusKey,
|
status_key: StatusKey,
|
||||||
unit: str,
|
unit: str,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that the sensor entities are capable of fetching units."""
|
"""Test that the sensor entities are capable of fetching units."""
|
||||||
|
|
||||||
|
@ -176,13 +176,13 @@ SERVICES_SET_PROGRAM_AND_OPTIONS = [
|
|||||||
SERVICE_KV_CALL_PARAMS + SERVICE_COMMAND_CALL_PARAMS + SERVICE_PROGRAM_CALL_PARAMS,
|
SERVICE_KV_CALL_PARAMS + SERVICE_COMMAND_CALL_PARAMS + SERVICE_PROGRAM_CALL_PARAMS,
|
||||||
)
|
)
|
||||||
async def test_key_value_services(
|
async def test_key_value_services(
|
||||||
service_call: dict[str, Any],
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
|
service_call: dict[str, Any],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Create and test services."""
|
"""Create and test services."""
|
||||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||||
@ -224,16 +224,16 @@ async def test_key_value_services(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_programs_and_options_actions_deprecation(
|
async def test_programs_and_options_actions_deprecation(
|
||||||
service_call: dict[str, Any],
|
|
||||||
issue_id: str,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
hass_client: ClientSessionGenerator,
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
|
issue_registry: ir.IssueRegistry,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
issue_registry: ir.IssueRegistry,
|
service_call: dict[str, Any],
|
||||||
hass_client: ClientSessionGenerator,
|
issue_id: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test deprecated service keys."""
|
"""Test deprecated service keys."""
|
||||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||||
@ -294,14 +294,14 @@ async def test_programs_and_options_actions_deprecation(
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
async def test_set_program_and_options(
|
async def test_set_program_and_options(
|
||||||
service_call: dict[str, Any],
|
|
||||||
called_method: str,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
|
service_call: dict[str, Any],
|
||||||
|
called_method: str,
|
||||||
snapshot: SnapshotAssertion,
|
snapshot: SnapshotAssertion,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test recognized options."""
|
"""Test recognized options."""
|
||||||
@ -337,14 +337,14 @@ async def test_set_program_and_options(
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
async def test_set_program_and_options_exceptions(
|
async def test_set_program_and_options_exceptions(
|
||||||
service_call: dict[str, Any],
|
|
||||||
error_regex: str,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
|
client_with_exception: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client_with_exception: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
|
service_call: dict[str, Any],
|
||||||
|
error_regex: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test recognized options."""
|
"""Test recognized options."""
|
||||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||||
@ -367,13 +367,13 @@ async def test_set_program_and_options_exceptions(
|
|||||||
SERVICE_KV_CALL_PARAMS + SERVICE_COMMAND_CALL_PARAMS + SERVICE_PROGRAM_CALL_PARAMS,
|
SERVICE_KV_CALL_PARAMS + SERVICE_COMMAND_CALL_PARAMS + SERVICE_PROGRAM_CALL_PARAMS,
|
||||||
)
|
)
|
||||||
async def test_services_exception_device_id(
|
async def test_services_exception_device_id(
|
||||||
service_call: dict[str, Any],
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
device_registry: dr.DeviceRegistry,
|
||||||
|
client_with_exception: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client_with_exception: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
device_registry: dr.DeviceRegistry,
|
service_call: dict[str, Any],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Raise a HomeAssistantError when there is an API error."""
|
"""Raise a HomeAssistantError when there is an API error."""
|
||||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||||
@ -393,10 +393,10 @@ async def test_services_exception_device_id(
|
|||||||
|
|
||||||
async def test_services_appliance_not_found(
|
async def test_services_appliance_not_found(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
device_registry: dr.DeviceRegistry,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
device_registry: dr.DeviceRegistry,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Raise a ServiceValidationError when device id does not match."""
|
"""Raise a ServiceValidationError when device id does not match."""
|
||||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||||
@ -439,13 +439,13 @@ async def test_services_appliance_not_found(
|
|||||||
SERVICE_KV_CALL_PARAMS + SERVICE_COMMAND_CALL_PARAMS + SERVICE_PROGRAM_CALL_PARAMS,
|
SERVICE_KV_CALL_PARAMS + SERVICE_COMMAND_CALL_PARAMS + SERVICE_PROGRAM_CALL_PARAMS,
|
||||||
)
|
)
|
||||||
async def test_services_exception(
|
async def test_services_exception(
|
||||||
service_call: dict[str, Any],
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
device_registry: dr.DeviceRegistry,
|
||||||
|
client_with_exception: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client_with_exception: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
device_registry: dr.DeviceRegistry,
|
service_call: dict[str, Any],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Raise a ValueError when device id does not match."""
|
"""Raise a ValueError when device id does not match."""
|
||||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||||
|
@ -71,13 +71,13 @@ def platforms() -> list[str]:
|
|||||||
|
|
||||||
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
|
||||||
async def test_paired_depaired_devices_flow(
|
async def test_paired_depaired_devices_flow(
|
||||||
appliance: HomeAppliance,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
||||||
client.get_available_program = AsyncMock(
|
client.get_available_program = AsyncMock(
|
||||||
@ -148,14 +148,14 @@ async def test_paired_depaired_devices_flow(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_connected_devices(
|
async def test_connected_devices(
|
||||||
appliance: HomeAppliance,
|
|
||||||
keys_to_check: tuple,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
appliance: HomeAppliance,
|
||||||
|
keys_to_check: tuple,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that devices reconnected.
|
"""Test that devices reconnected.
|
||||||
|
|
||||||
@ -219,9 +219,9 @@ async def test_connected_devices(
|
|||||||
@pytest.mark.parametrize("appliance", ["Dishwasher"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Dishwasher"], indirect=True)
|
||||||
async def test_switch_entity_availability(
|
async def test_switch_entity_availability(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test if switch entities availability are based on the appliance connection state."""
|
"""Test if switch entities availability are based on the appliance connection state."""
|
||||||
@ -300,16 +300,16 @@ async def test_switch_entity_availability(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_switch_functionality(
|
async def test_switch_functionality(
|
||||||
entity_id: str,
|
|
||||||
settings_key_arg: SettingKey,
|
|
||||||
setting_value_arg: Any,
|
|
||||||
service: str,
|
|
||||||
state: str,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
entity_id: str,
|
||||||
|
service: str,
|
||||||
|
settings_key_arg: SettingKey,
|
||||||
|
setting_value_arg: Any,
|
||||||
|
state: str,
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test switch functionality."""
|
"""Test switch functionality."""
|
||||||
|
|
||||||
@ -345,14 +345,14 @@ async def test_switch_functionality(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_program_switch_functionality(
|
async def test_program_switch_functionality(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
program_key: ProgramKey,
|
program_key: ProgramKey,
|
||||||
initial_state: str,
|
initial_state: str,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test switch functionality."""
|
"""Test switch functionality."""
|
||||||
|
|
||||||
@ -450,14 +450,14 @@ async def test_program_switch_functionality(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_switch_exception_handling(
|
async def test_switch_exception_handling(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client_with_exception: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
service: str,
|
service: str,
|
||||||
mock_attr: str,
|
mock_attr: str,
|
||||||
exception_match: str,
|
exception_match: str,
|
||||||
hass: HomeAssistant,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
client_with_exception: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test exception handling."""
|
"""Test exception handling."""
|
||||||
client_with_exception.get_all_programs.side_effect = None
|
client_with_exception.get_all_programs.side_effect = None
|
||||||
@ -504,18 +504,16 @@ async def test_switch_exception_handling(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("entity_id", "status", "service", "state", "appliance"),
|
("entity_id", "service", "state", "appliance"),
|
||||||
[
|
[
|
||||||
(
|
(
|
||||||
"switch.fridgefreezer_freezer_super_mode",
|
"switch.fridgefreezer_freezer_super_mode",
|
||||||
{SettingKey.REFRIGERATION_FRIDGE_FREEZER_SUPER_MODE_FREEZER: True},
|
|
||||||
SERVICE_TURN_ON,
|
SERVICE_TURN_ON,
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
"FridgeFreezer",
|
"FridgeFreezer",
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"switch.fridgefreezer_freezer_super_mode",
|
"switch.fridgefreezer_freezer_super_mode",
|
||||||
{SettingKey.REFRIGERATION_FRIDGE_FREEZER_SUPER_MODE_FREEZER: False},
|
|
||||||
SERVICE_TURN_OFF,
|
SERVICE_TURN_OFF,
|
||||||
STATE_OFF,
|
STATE_OFF,
|
||||||
"FridgeFreezer",
|
"FridgeFreezer",
|
||||||
@ -524,15 +522,13 @@ async def test_switch_exception_handling(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_ent_desc_switch_functionality(
|
async def test_ent_desc_switch_functionality(
|
||||||
entity_id: str,
|
|
||||||
status: dict,
|
|
||||||
service: str,
|
|
||||||
state: str,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
appliance: HomeAppliance,
|
entity_id: str,
|
||||||
client: MagicMock,
|
service: str,
|
||||||
|
state: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test switch functionality - entity description setup."""
|
"""Test switch functionality - entity description setup."""
|
||||||
|
|
||||||
@ -550,7 +546,6 @@ async def test_ent_desc_switch_functionality(
|
|||||||
"entity_id",
|
"entity_id",
|
||||||
"status",
|
"status",
|
||||||
"service",
|
"service",
|
||||||
"mock_attr",
|
|
||||||
"appliance",
|
"appliance",
|
||||||
"exception_match",
|
"exception_match",
|
||||||
),
|
),
|
||||||
@ -559,7 +554,6 @@ async def test_ent_desc_switch_functionality(
|
|||||||
"switch.fridgefreezer_freezer_super_mode",
|
"switch.fridgefreezer_freezer_super_mode",
|
||||||
{SettingKey.REFRIGERATION_FRIDGE_FREEZER_SUPER_MODE_FREEZER: ""},
|
{SettingKey.REFRIGERATION_FRIDGE_FREEZER_SUPER_MODE_FREEZER: ""},
|
||||||
SERVICE_TURN_ON,
|
SERVICE_TURN_ON,
|
||||||
"set_setting",
|
|
||||||
"FridgeFreezer",
|
"FridgeFreezer",
|
||||||
r"Error.*turn.*on.*",
|
r"Error.*turn.*on.*",
|
||||||
),
|
),
|
||||||
@ -567,7 +561,6 @@ async def test_ent_desc_switch_functionality(
|
|||||||
"switch.fridgefreezer_freezer_super_mode",
|
"switch.fridgefreezer_freezer_super_mode",
|
||||||
{SettingKey.REFRIGERATION_FRIDGE_FREEZER_SUPER_MODE_FREEZER: ""},
|
{SettingKey.REFRIGERATION_FRIDGE_FREEZER_SUPER_MODE_FREEZER: ""},
|
||||||
SERVICE_TURN_OFF,
|
SERVICE_TURN_OFF,
|
||||||
"set_setting",
|
|
||||||
"FridgeFreezer",
|
"FridgeFreezer",
|
||||||
r"Error.*turn.*off.*",
|
r"Error.*turn.*off.*",
|
||||||
),
|
),
|
||||||
@ -575,16 +568,14 @@ async def test_ent_desc_switch_functionality(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_ent_desc_switch_exception_handling(
|
async def test_ent_desc_switch_exception_handling(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client_with_exception: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
status: dict[SettingKey, str],
|
status: dict[SettingKey, str],
|
||||||
service: str,
|
service: str,
|
||||||
mock_attr: str,
|
|
||||||
exception_match: str,
|
exception_match: str,
|
||||||
hass: HomeAssistant,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
appliance: HomeAppliance,
|
|
||||||
client_with_exception: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test switch exception handling - entity description setup."""
|
"""Test switch exception handling - entity description setup."""
|
||||||
client_with_exception.get_settings.side_effect = None
|
client_with_exception.get_settings.side_effect = None
|
||||||
@ -658,16 +649,16 @@ async def test_ent_desc_switch_exception_handling(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_power_switch(
|
async def test_power_switch(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
allowed_values: list[str | None] | None,
|
allowed_values: list[str | None] | None,
|
||||||
service: str,
|
service: str,
|
||||||
setting_value_arg: str,
|
setting_value_arg: str,
|
||||||
power_state: str,
|
power_state: str,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test power switch functionality."""
|
"""Test power switch functionality."""
|
||||||
client.get_settings.side_effect = None
|
client.get_settings.side_effect = None
|
||||||
@ -706,11 +697,11 @@ async def test_power_switch(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_power_switch_fetch_off_state_from_current_value(
|
async def test_power_switch_fetch_off_state_from_current_value(
|
||||||
initial_value: str,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
initial_value: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test power switch functionality to fetch the off state from the current value."""
|
"""Test power switch functionality to fetch the off state from the current value."""
|
||||||
client.get_settings.side_effect = None
|
client.get_settings.side_effect = None
|
||||||
@ -755,14 +746,14 @@ async def test_power_switch_fetch_off_state_from_current_value(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_power_switch_service_validation_errors(
|
async def test_power_switch_service_validation_errors(
|
||||||
entity_id: str,
|
|
||||||
allowed_values: list[str | None] | None | HomeConnectError,
|
|
||||||
service: str,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
exception_match: str,
|
exception_match: str,
|
||||||
client: MagicMock,
|
entity_id: str,
|
||||||
|
allowed_values: list[str | None] | None | HomeConnectError,
|
||||||
|
service: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test power switch functionality validation errors."""
|
"""Test power switch functionality validation errors."""
|
||||||
client.get_settings.side_effect = None
|
client.get_settings.side_effect = None
|
||||||
@ -807,12 +798,11 @@ async def test_power_switch_service_validation_errors(
|
|||||||
)
|
)
|
||||||
async def test_create_program_switch_deprecation_issue(
|
async def test_create_program_switch_deprecation_issue(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
appliance: HomeAppliance,
|
issue_registry: ir.IssueRegistry,
|
||||||
service: str,
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
service: str,
|
||||||
issue_registry: ir.IssueRegistry,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that we create an issue when an automation or script is using a program switch entity or the entity is used by the user."""
|
"""Test that we create an issue when an automation or script is using a program switch entity or the entity is used by the user."""
|
||||||
entity_id = "switch.washer_program_mix"
|
entity_id = "switch.washer_program_mix"
|
||||||
@ -888,13 +878,12 @@ async def test_create_program_switch_deprecation_issue(
|
|||||||
)
|
)
|
||||||
async def test_program_switch_deprecation_issue_fix(
|
async def test_program_switch_deprecation_issue_fix(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
appliance: HomeAppliance,
|
hass_client: ClientSessionGenerator,
|
||||||
service: str,
|
issue_registry: ir.IssueRegistry,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
service: str,
|
||||||
issue_registry: ir.IssueRegistry,
|
|
||||||
hass_client: ClientSessionGenerator,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test we can fix the issues created when a program switch entity is in an automation or in a script or when is used."""
|
"""Test we can fix the issues created when a program switch entity is in an automation or in a script or when is used."""
|
||||||
entity_id = "switch.washer_program_mix"
|
entity_id = "switch.washer_program_mix"
|
||||||
@ -1001,16 +990,16 @@ async def test_program_switch_deprecation_issue_fix(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_options_functionality(
|
async def test_options_functionality(
|
||||||
entity_id: str,
|
hass: HomeAssistant,
|
||||||
option_key: OptionKey,
|
client: MagicMock,
|
||||||
appliance: HomeAppliance,
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
set_active_program_options_side_effect: ActiveProgramNotSetError | None,
|
set_active_program_options_side_effect: ActiveProgramNotSetError | None,
|
||||||
set_selected_program_options_side_effect: SelectedProgramNotSetError | None,
|
set_selected_program_options_side_effect: SelectedProgramNotSetError | None,
|
||||||
called_mock_method: str,
|
called_mock_method: str,
|
||||||
hass: HomeAssistant,
|
entity_id: str,
|
||||||
config_entry: MockConfigEntry,
|
option_key: OptionKey,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
appliance: HomeAppliance,
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test options functionality."""
|
"""Test options functionality."""
|
||||||
if set_active_program_options_side_effect:
|
if set_active_program_options_side_effect:
|
||||||
|
@ -48,13 +48,13 @@ def platforms() -> list[str]:
|
|||||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||||
@pytest.mark.parametrize("appliance", ["Oven"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Oven"], indirect=True)
|
||||||
async def test_paired_depaired_devices_flow(
|
async def test_paired_depaired_devices_flow(
|
||||||
appliance: HomeAppliance,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
||||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||||
@ -111,14 +111,14 @@ async def test_paired_depaired_devices_flow(
|
|||||||
indirect=["appliance"],
|
indirect=["appliance"],
|
||||||
)
|
)
|
||||||
async def test_connected_devices(
|
async def test_connected_devices(
|
||||||
appliance: HomeAppliance,
|
|
||||||
keys_to_check: tuple,
|
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
|
appliance: HomeAppliance,
|
||||||
|
keys_to_check: tuple,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that devices reconnected.
|
"""Test that devices reconnected.
|
||||||
|
|
||||||
@ -172,9 +172,9 @@ async def test_connected_devices(
|
|||||||
@pytest.mark.parametrize("appliance", ["Oven"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Oven"], indirect=True)
|
||||||
async def test_time_entity_availability(
|
async def test_time_entity_availability(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test if time entities availability are based on the appliance connection state."""
|
"""Test if time entities availability are based on the appliance connection state."""
|
||||||
@ -233,13 +233,13 @@ async def test_time_entity_availability(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_time_entity_functionality(
|
async def test_time_entity_functionality(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
appliance: HomeAppliance,
|
appliance: HomeAppliance,
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
setting_key: SettingKey,
|
setting_key: SettingKey,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test time entity functionality."""
|
"""Test time entity functionality."""
|
||||||
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
||||||
@ -277,13 +277,13 @@ async def test_time_entity_functionality(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_time_entity_error(
|
async def test_time_entity_error(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client_with_exception: MagicMock,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
setting_key: SettingKey,
|
setting_key: SettingKey,
|
||||||
mock_attr: str,
|
mock_attr: str,
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
|
||||||
client_with_exception: MagicMock,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test time entity error."""
|
"""Test time entity error."""
|
||||||
client_with_exception.get_settings.side_effect = None
|
client_with_exception.get_settings.side_effect = None
|
||||||
@ -322,11 +322,10 @@ async def test_time_entity_error(
|
|||||||
@pytest.mark.parametrize("appliance", ["Oven"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Oven"], indirect=True)
|
||||||
async def test_create_alarm_clock_deprecation_issue(
|
async def test_create_alarm_clock_deprecation_issue(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
appliance: HomeAppliance,
|
issue_registry: ir.IssueRegistry,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
issue_registry: ir.IssueRegistry,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that we create an issue when an automation or script is using a alarm clock time entity or the entity is used by the user."""
|
"""Test that we create an issue when an automation or script is using a alarm clock time entity or the entity is used by the user."""
|
||||||
entity_id = f"{TIME_DOMAIN}.oven_alarm_clock"
|
entity_id = f"{TIME_DOMAIN}.oven_alarm_clock"
|
||||||
@ -402,12 +401,11 @@ async def test_create_alarm_clock_deprecation_issue(
|
|||||||
@pytest.mark.parametrize("appliance", ["Oven"], indirect=True)
|
@pytest.mark.parametrize("appliance", ["Oven"], indirect=True)
|
||||||
async def test_alarm_clock_deprecation_issue_fix(
|
async def test_alarm_clock_deprecation_issue_fix(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
appliance: HomeAppliance,
|
hass_client: ClientSessionGenerator,
|
||||||
|
issue_registry: ir.IssueRegistry,
|
||||||
|
client: MagicMock,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||||
client: MagicMock,
|
|
||||||
issue_registry: ir.IssueRegistry,
|
|
||||||
hass_client: ClientSessionGenerator,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test we can fix the issues created when a alarm clock time entity is in an automation or in a script or when is used."""
|
"""Test we can fix the issues created when a alarm clock time entity is in an automation or in a script or when is used."""
|
||||||
entity_id = f"{TIME_DOMAIN}.oven_alarm_clock"
|
entity_id = f"{TIME_DOMAIN}.oven_alarm_clock"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user