From 267a39b14d75d1314fc0bc25d730941985fd625f Mon Sep 17 00:00:00 2001 From: Jean-Marc Collin Date: Wed, 6 Mar 2024 18:31:04 +0000 Subject: [PATCH] All testus ok --- tests/commons.py | 23 ++++++++++------------- tests/test_central_config.py | 4 ++-- tests/test_start.py | 2 +- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/tests/commons.py b/tests/commons.py index 17c2249..975a123 100644 --- a/tests/commons.py +++ b/tests/commons.py @@ -493,21 +493,18 @@ async def create_thermostat( hass: HomeAssistant, entry: MockConfigEntry, entity_id: str ) -> BaseThermostat: """Creates and return a TPI Thermostat""" - with patch( - "custom_components.versatile_thermostat.base_thermostat.BaseThermostat.send_event" - ): - entry.add_to_hass(hass) - await hass.config_entries.async_setup(entry.entry_id) - assert entry.state is ConfigEntryState.LOADED + entry.add_to_hass(hass) + await hass.config_entries.async_setup(entry.entry_id) + assert entry.state is ConfigEntryState.LOADED - # We should reload the VTherm links - # vtherm_api: VersatileThermostatAPI = VersatileThermostatAPI.get_vtherm_api() - # central_config = vtherm_api.find_central_configuration() - entity = search_entity(hass, entity_id, CLIMATE_DOMAIN) - # if entity and hasattr(entity, "init_presets"):: - # await entity.init_presets(central_config) + # We should reload the VTherm links + # vtherm_api: VersatileThermostatAPI = VersatileThermostatAPI.get_vtherm_api() + # central_config = vtherm_api.find_central_configuration() + entity = search_entity(hass, entity_id, CLIMATE_DOMAIN) + # if entity and hasattr(entity, "init_presets"):: + # await entity.init_presets(central_config) - return entity + return entity async def create_central_config( # pylint: disable=dangerous-default-value diff --git a/tests/test_central_config.py b/tests/test_central_config.py index 1dacc51..defbadc 100644 --- a/tests/test_central_config.py +++ b/tests/test_central_config.py @@ -104,8 +104,8 @@ async def test_add_a_central_config(hass: HomeAssistant, skip_hass_states_is_sta assert api.nb_active_device_for_boiler_entity is None assert api.nb_active_device_for_boiler is None - assert api.nb_active_device_for_boiler_threshold_entity is None - assert api.nb_active_device_for_boiler_threshold is None + assert api.nb_active_device_for_boiler_threshold_entity is not None + assert api.nb_active_device_for_boiler_threshold == 1 # the default value # @pytest.mark.parametrize("expected_lingering_tasks", [True]) diff --git a/tests/test_start.py b/tests/test_start.py index 2821517..9b25437 100644 --- a/tests/test_start.py +++ b/tests/test_start.py @@ -193,7 +193,7 @@ async def test_over_4switch_full_start(hass: HomeAssistant, skip_hass_states_is_ assert entity assert entity.name == "TheOver4SwitchMockName" - assert entity.is_over_climate is False + assert entity.is_over_switch assert entity.hvac_action is HVACAction.OFF assert entity.hvac_mode is HVACMode.OFF assert entity.target_temperature == entity.min_temp