mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Move Home Connect entry state assertion at tests (#144027)
This commit is contained in:
parent
abd17d9af9
commit
883ab44437
@ -36,6 +36,7 @@ from homeassistant.components.application_credentials import (
|
||||
async_import_client_credential,
|
||||
)
|
||||
from homeassistant.components.home_connect.const import DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
@ -147,6 +148,7 @@ async def mock_integration_setup(
|
||||
config_entry.add_to_hass(hass)
|
||||
|
||||
async def run(client: MagicMock) -> bool:
|
||||
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
||||
with (
|
||||
patch("homeassistant.components.home_connect.PLATFORMS", platforms),
|
||||
patch(
|
||||
|
@ -51,7 +51,6 @@ async def test_paired_depaired_devices_flow(
|
||||
appliance: HomeAppliance,
|
||||
) -> None:
|
||||
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -128,7 +127,6 @@ async def test_connected_devices(
|
||||
return get_status_original_mock.return_value
|
||||
|
||||
client.get_status = AsyncMock(side_effect=get_status_side_effect)
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
client.get_status = get_status_original_mock
|
||||
@ -179,7 +177,6 @@ async def test_binary_sensors_entity_availability(
|
||||
entity_ids = [
|
||||
"binary_sensor.washer_remote_control",
|
||||
]
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -279,7 +276,6 @@ async def test_binary_sensors_functionality(
|
||||
expected: str,
|
||||
) -> None:
|
||||
"""Tests for Home Connect Fridge appliance door states."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
await client.add_events(
|
||||
@ -316,7 +312,6 @@ async def test_connected_sensor_functionality(
|
||||
) -> None:
|
||||
"""Test if the connected binary sensor reports the right values."""
|
||||
entity_id = "binary_sensor.washer_connectivity"
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
|
@ -43,7 +43,6 @@ async def test_paired_depaired_devices_flow(
|
||||
appliance: HomeAppliance,
|
||||
) -> None:
|
||||
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -131,7 +130,6 @@ async def test_connected_devices(
|
||||
side_effect=get_available_commands_side_effect
|
||||
)
|
||||
client.get_all_programs = AsyncMock(side_effect=get_all_programs_side_effect)
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
client.get_available_commands = get_available_commands_original_mock
|
||||
@ -183,7 +181,6 @@ async def test_button_entity_availability(
|
||||
"button.washer_pause_program",
|
||||
"button.washer_stop_program",
|
||||
]
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -246,7 +243,6 @@ async def test_button_functionality(
|
||||
appliance: HomeAppliance,
|
||||
) -> None:
|
||||
"""Test if button entities availability are based on the appliance connection state."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -282,7 +278,6 @@ async def test_command_button_exception(
|
||||
]
|
||||
)
|
||||
)
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client_with_exception)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -308,7 +303,6 @@ async def test_stop_program_button_exception(
|
||||
"""Test if button entities availability are based on the appliance connection state."""
|
||||
entity_id = "button.washer_stop_program"
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client_with_exception)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
|
@ -218,7 +218,6 @@ async def test_coordinator_not_fetching_on_disconnected_appliance(
|
||||
"""Test that the coordinator does not fetch anything on disconnected appliance."""
|
||||
appliance.connected = False
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -242,7 +241,6 @@ async def test_coordinator_update_failing(
|
||||
"""
|
||||
setattr(client, mock_method, AsyncMock(side_effect=HomeConnectError()))
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -286,7 +284,6 @@ async def test_event_listener(
|
||||
entity_id: str,
|
||||
) -> None:
|
||||
"""Test that the event listener works."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -353,7 +350,6 @@ async def tests_receive_setting_and_status_for_first_time_at_events(
|
||||
client.get_setting = AsyncMock(return_value=ArrayOfSettings([]))
|
||||
client.get_status = AsyncMock(return_value=ArrayOfStatus([]))
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -468,7 +464,6 @@ async def test_event_listener_resilience(
|
||||
side_effect=[stream_exception(), client.stream_all_events()]
|
||||
)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
await integration_setup(client)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@ -531,7 +526,6 @@ async def test_devices_updated_on_refresh(
|
||||
)
|
||||
|
||||
await async_setup_component(hass, HA_DOMAIN, {})
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -564,7 +558,6 @@ async def test_paired_disconnected_devices_not_fetching(
|
||||
) -> None:
|
||||
"""Test that Home Connect API is not fetched after pairing a disconnected device."""
|
||||
client.get_home_appliances = AsyncMock(return_value=ArrayOfHomeAppliances([]))
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -601,7 +594,6 @@ async def test_coordinator_disabling_updates_for_appliance(
|
||||
appliance_ha_id = "SIEMENS-HCS02DWH1-6BE58C26DCC1"
|
||||
issue_id = f"home_connect_too_many_connected_paired_events_{appliance_ha_id}"
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -692,7 +684,6 @@ async def test_coordinator_disabling_updates_for_appliance_is_gone_after_entry_r
|
||||
appliance_ha_id = "SIEMENS-HCS02DWH1-6BE58C26DCC1"
|
||||
issue_id = f"home_connect_too_many_connected_paired_events_{appliance_ha_id}"
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -718,7 +709,6 @@ async def test_coordinator_disabling_updates_for_appliance_is_gone_after_entry_r
|
||||
|
||||
assert not issue_registry.async_get_issue(DOMAIN, issue_id)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
|
@ -25,7 +25,6 @@ async def test_async_get_config_entry_diagnostics(
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test config entry diagnostics."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -41,7 +40,6 @@ async def test_async_get_device_diagnostics(
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test device config entry diagnostics."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
|
@ -157,7 +157,6 @@ async def test_program_options_retrieval(
|
||||
)
|
||||
)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -276,7 +275,6 @@ async def test_no_options_retrieval_on_unknown_program(
|
||||
|
||||
client.get_all_programs = AsyncMock(side_effect=get_all_programs_with_options_mock)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -357,7 +355,6 @@ async def test_program_options_retrieval_after_appliance_connection(
|
||||
)
|
||||
)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -469,7 +466,6 @@ async def test_option_entity_functionality_exception(
|
||||
)
|
||||
)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
|
@ -46,7 +46,6 @@ async def test_entry_setup(
|
||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||
) -> None:
|
||||
"""Test setup and unload."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -182,7 +181,6 @@ async def test_client_error(
|
||||
"""Test client errors during setup integration."""
|
||||
client_with_exception.get_home_appliances.return_value = None
|
||||
client_with_exception.get_home_appliances.side_effect = exception
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert not await integration_setup(client_with_exception)
|
||||
assert config_entry.state == expected_state
|
||||
assert client_with_exception.get_home_appliances.call_count == 1
|
||||
@ -239,7 +237,6 @@ async def test_required_program_or_at_least_an_option(
|
||||
) -> None:
|
||||
"Test that the set_program_and_options does raise an exception if no program nor options are set."
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
|
@ -64,7 +64,6 @@ async def test_paired_depaired_devices_flow(
|
||||
appliance: HomeAppliance,
|
||||
) -> None:
|
||||
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -141,7 +140,6 @@ async def test_connected_devices(
|
||||
return await get_settings_original_mock.side_effect(ha_id)
|
||||
|
||||
client.get_settings = AsyncMock(side_effect=get_settings_side_effect)
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
client.get_settings = get_settings_original_mock
|
||||
@ -186,7 +184,6 @@ async def test_light_availability(
|
||||
entity_ids = [
|
||||
"light.hood_functional_light",
|
||||
]
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -353,7 +350,6 @@ async def test_light_functionality(
|
||||
appliance: HomeAppliance,
|
||||
) -> None:
|
||||
"""Test light functionality."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -405,7 +401,6 @@ async def test_light_color_different_than_custom(
|
||||
appliance: HomeAppliance,
|
||||
) -> None:
|
||||
"""Test that light color attributes are not set if color is different than custom."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
await hass.services.async_call(
|
||||
@ -586,7 +581,6 @@ async def test_light_exception_handling(
|
||||
client_with_exception.set_setting.side_effect = [
|
||||
exception() if exception else None for exception in attr_side_effect
|
||||
]
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client_with_exception)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
|
@ -80,7 +80,6 @@ async def test_paired_depaired_devices_flow(
|
||||
],
|
||||
)
|
||||
)
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -159,7 +158,6 @@ async def test_connected_devices(
|
||||
return get_settings_original_mock.return_value
|
||||
|
||||
client.get_settings = AsyncMock(side_effect=get_settings_side_effect)
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
client.get_settings = get_settings_original_mock
|
||||
@ -209,7 +207,6 @@ async def test_number_entity_availability(
|
||||
# Setting constrains are not needed for this test
|
||||
# so we rise an error to easily test the availability
|
||||
client.get_setting = AsyncMock(side_effect=HomeConnectError())
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -316,7 +313,6 @@ async def test_number_entity_functionality(
|
||||
)
|
||||
)
|
||||
|
||||
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
entity_state = hass.states.get(entity_id)
|
||||
@ -420,7 +416,6 @@ async def test_fetch_constraints_after_rate_limit_error(
|
||||
]
|
||||
)
|
||||
|
||||
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
async_fire_time_changed(hass)
|
||||
await hass.async_block_till_done()
|
||||
@ -472,7 +467,6 @@ async def test_number_entity_error(
|
||||
)
|
||||
]
|
||||
)
|
||||
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client_with_exception)
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
@ -599,7 +593,6 @@ async def test_options_functionality(
|
||||
)
|
||||
)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
entity_state = hass.states.get(entity_id)
|
||||
|
@ -84,7 +84,6 @@ async def test_paired_depaired_devices_flow(
|
||||
],
|
||||
)
|
||||
)
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -174,7 +173,6 @@ async def test_connected_devices(
|
||||
|
||||
client.get_settings = AsyncMock(side_effect=get_settings_side_effect)
|
||||
client.get_all_programs = AsyncMock(side_effect=get_all_programs_side_effect)
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
client.get_settings = get_settings_original_mock
|
||||
@ -220,7 +218,6 @@ async def test_select_entity_availability(
|
||||
entity_ids = [
|
||||
"select.washer_active_program",
|
||||
]
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -298,7 +295,6 @@ async def test_filter_programs(
|
||||
]
|
||||
)
|
||||
|
||||
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
@ -365,7 +361,6 @@ async def test_select_program_functionality(
|
||||
event_key: EventKey,
|
||||
) -> None:
|
||||
"""Test select functionality."""
|
||||
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
@ -448,7 +443,6 @@ async def test_select_exception_handling(
|
||||
]
|
||||
)
|
||||
|
||||
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client_with_exception)
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
@ -494,7 +488,6 @@ async def test_programs_updated_on_connect(
|
||||
return await get_all_programs_mock.side_effect(ha_id)
|
||||
|
||||
client.get_all_programs = AsyncMock(side_effect=get_all_programs_side_effect)
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
client.get_all_programs = get_all_programs_mock
|
||||
@ -566,7 +559,6 @@ async def test_select_functionality(
|
||||
expected_value_call_arg: str,
|
||||
) -> None:
|
||||
"""Test select functionality."""
|
||||
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
@ -646,7 +638,6 @@ async def test_fetch_allowed_values(
|
||||
|
||||
client.get_setting = AsyncMock(side_effect=get_setting_side_effect)
|
||||
|
||||
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
@ -713,7 +704,6 @@ async def test_fetch_allowed_values_after_rate_limit_error(
|
||||
]
|
||||
)
|
||||
|
||||
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
async_fire_time_changed(hass)
|
||||
await hass.async_block_till_done()
|
||||
@ -775,7 +765,6 @@ async def test_default_values_after_fetch_allowed_values_error(
|
||||
client.get_settings = AsyncMock(side_effect=get_settings_side_effect)
|
||||
client.get_setting = AsyncMock(side_effect=exception)
|
||||
|
||||
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
@ -821,7 +810,6 @@ async def test_select_entity_error(
|
||||
)
|
||||
]
|
||||
)
|
||||
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client_with_exception)
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
@ -952,7 +940,6 @@ async def test_options_functionality(
|
||||
)
|
||||
)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
entity_state = hass.states.get(entity_id)
|
||||
|
@ -100,7 +100,6 @@ async def test_paired_depaired_devices_flow(
|
||||
appliance: HomeAppliance,
|
||||
) -> None:
|
||||
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -200,7 +199,6 @@ async def test_connected_devices(
|
||||
return get_status_original_mock.return_value
|
||||
|
||||
client.get_status = AsyncMock(side_effect=get_status_side_effect)
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
client.get_status = get_status_original_mock
|
||||
@ -246,7 +244,6 @@ async def test_sensor_entity_availability(
|
||||
"sensor.dishwasher_operation_state",
|
||||
"sensor.dishwasher_salt_nearly_empty",
|
||||
]
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -452,7 +449,6 @@ async def test_program_sensor_edge_case(
|
||||
)
|
||||
)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -515,7 +511,6 @@ async def test_remaining_prog_time_edge_cases(
|
||||
time_to_freeze = "2021-01-09 12:00:00+00:00"
|
||||
freezer.move_to(time_to_freeze)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -591,7 +586,6 @@ async def test_sensors_states(
|
||||
appliance: HomeAppliance,
|
||||
) -> None:
|
||||
"""Tests for appliance sensors."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -653,7 +647,6 @@ async def test_event_sensors_states(
|
||||
) -> None:
|
||||
"""Tests for appliance event sensors."""
|
||||
caplog.set_level(logging.ERROR)
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -763,7 +756,6 @@ async def test_sensor_unit_fetching(
|
||||
)
|
||||
)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -819,7 +811,6 @@ async def test_sensor_unit_fetching_error(
|
||||
client.get_status = AsyncMock(side_effect=get_status_mock)
|
||||
client.get_status_value = AsyncMock(side_effect=HomeConnectError())
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -881,7 +872,6 @@ async def test_sensor_unit_fetching_after_rate_limit_error(
|
||||
]
|
||||
)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
async_fire_time_changed(hass)
|
||||
await hass.async_block_till_done()
|
||||
|
@ -185,7 +185,6 @@ async def test_key_value_services(
|
||||
service_call: dict[str, Any],
|
||||
) -> None:
|
||||
"""Create and test services."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -236,7 +235,6 @@ async def test_programs_and_options_actions_deprecation(
|
||||
issue_id: str,
|
||||
) -> None:
|
||||
"""Test deprecated service keys."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -305,7 +303,6 @@ async def test_set_program_and_options(
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test recognized options."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -347,7 +344,6 @@ async def test_set_program_and_options_exceptions(
|
||||
error_regex: str,
|
||||
) -> None:
|
||||
"""Test recognized options."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client_with_exception)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -376,7 +372,6 @@ async def test_services_exception_device_id(
|
||||
service_call: dict[str, Any],
|
||||
) -> None:
|
||||
"""Raise a HomeAssistantError when there is an API error."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client_with_exception)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -399,7 +394,6 @@ async def test_services_appliance_not_found(
|
||||
integration_setup: Callable[[MagicMock], Awaitable[bool]],
|
||||
) -> None:
|
||||
"""Raise a ServiceValidationError when device id does not match."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -448,7 +442,6 @@ async def test_services_exception(
|
||||
service_call: dict[str, Any],
|
||||
) -> None:
|
||||
"""Raise a ValueError when device id does not match."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client_with_exception)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
|
@ -91,7 +91,6 @@ async def test_paired_depaired_devices_flow(
|
||||
],
|
||||
)
|
||||
)
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -181,7 +180,6 @@ async def test_connected_devices(
|
||||
|
||||
client.get_settings = AsyncMock(side_effect=get_settings_side_effect)
|
||||
client.get_all_programs = AsyncMock(side_effect=get_all_programs_side_effect)
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
client.get_settings = get_settings_original_mock
|
||||
@ -230,7 +228,6 @@ async def test_switch_entity_availability(
|
||||
"switch.dishwasher_child_lock",
|
||||
"switch.dishwasher_program_eco50",
|
||||
]
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -313,7 +310,6 @@ async def test_switch_functionality(
|
||||
) -> None:
|
||||
"""Test switch functionality."""
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -380,7 +376,6 @@ async def test_program_switch_functionality(
|
||||
)
|
||||
|
||||
client.stop_program = AsyncMock(side_effect=mock_stop_program)
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
assert hass.states.is_state(entity_id, initial_state)
|
||||
@ -488,7 +483,6 @@ async def test_switch_exception_handling(
|
||||
]
|
||||
)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client_with_exception)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -532,7 +526,6 @@ async def test_ent_desc_switch_functionality(
|
||||
) -> None:
|
||||
"""Test switch functionality - entity description setup."""
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -589,7 +582,6 @@ async def test_ent_desc_switch_exception_handling(
|
||||
for key, value in status.items()
|
||||
]
|
||||
)
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client_with_exception)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -675,7 +667,6 @@ async def test_power_switch(
|
||||
]
|
||||
)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -715,7 +706,6 @@ async def test_power_switch_fetch_off_state_from_current_value(
|
||||
]
|
||||
)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -781,7 +771,6 @@ async def test_power_switch_service_validation_errors(
|
||||
client.get_settings.return_value = ArrayOfSettings([setting])
|
||||
client.get_setting = AsyncMock(return_value=setting)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -842,7 +831,6 @@ async def test_create_program_switch_deprecation_issue(
|
||||
},
|
||||
)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -923,7 +911,6 @@ async def test_program_switch_deprecation_issue_fix(
|
||||
},
|
||||
)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -1018,7 +1005,6 @@ async def test_options_functionality(
|
||||
)
|
||||
)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
assert hass.states.get(entity_id)
|
||||
|
@ -57,7 +57,6 @@ async def test_paired_depaired_devices_flow(
|
||||
appliance: HomeAppliance,
|
||||
) -> None:
|
||||
"""Test that removed devices are correctly removed from and added to hass on API events."""
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -135,7 +134,6 @@ async def test_connected_devices(
|
||||
return await get_settings_original_mock.side_effect(ha_id)
|
||||
|
||||
client.get_settings = AsyncMock(side_effect=get_settings_side_effect)
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
client.get_settings = get_settings_original_mock
|
||||
@ -181,7 +179,6 @@ async def test_time_entity_availability(
|
||||
entity_ids = [
|
||||
"time.oven_alarm_clock",
|
||||
]
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -242,7 +239,6 @@ async def test_time_entity_functionality(
|
||||
setting_key: SettingKey,
|
||||
) -> None:
|
||||
"""Test time entity functionality."""
|
||||
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
@ -296,7 +292,6 @@ async def test_time_entity_error(
|
||||
)
|
||||
]
|
||||
)
|
||||
assert config_entry.state is ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client_with_exception)
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
@ -367,7 +362,6 @@ async def test_create_alarm_clock_deprecation_issue(
|
||||
},
|
||||
)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
@ -447,7 +441,6 @@ async def test_alarm_clock_deprecation_issue_fix(
|
||||
},
|
||||
)
|
||||
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup(client)
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user