Add valve change tests (ko)

This commit is contained in:
Jean-Marc Collin
2023-10-27 06:57:40 +00:00
parent 7afa67336b
commit e7c39f144b
11 changed files with 187 additions and 203 deletions

View File

@@ -58,7 +58,7 @@ async def test_one_switch_cycle(
# start heating, in boost mode. We block the control_heating to avoid running a cycle
with patch(
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat._async_control_heating"
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat.async_control_heating"
):
await entity.async_set_hvac_mode(HVACMode.HEAT)
await entity.async_set_preset_mode(PRESET_BOOST)
@@ -75,7 +75,7 @@ async def test_one_switch_cycle(
with patch(
"homeassistant.core.StateMachine.is_state", return_value=False
) as mock_is_state:
assert entity._is_device_active is False # pylint: disable=protected-access
assert entity.is_device_active is False # pylint: disable=protected-access
# Should be call for the Switch
assert mock_is_state.call_count == 1
@@ -269,7 +269,7 @@ async def test_multiple_switchs(
# start heating, in boost mode. We block the control_heating to avoid running a cycle
with patch(
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat._async_control_heating"
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat.async_control_heating"
), patch(
"custom_components.versatile_thermostat.underlyings.UnderlyingSwitch.set_hvac_mode"
) as mock_underlying_set_hvac_mode:
@@ -285,7 +285,7 @@ async def test_multiple_switchs(
await send_temperature_change_event(entity, 15, event_timestamp)
# Checks that all climates are off
assert entity._is_device_active is False # pylint: disable=protected-access
assert entity.is_device_active is False # pylint: disable=protected-access
# Should be call for all Switch
assert mock_underlying_set_hvac_mode.call_count == 4
@@ -405,7 +405,7 @@ async def test_multiple_climates(
# start heating, in boost mode. We block the control_heating to avoid running a cycle
with patch(
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat._async_control_heating"
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat.async_control_heating"
), patch(
"custom_components.versatile_thermostat.underlyings.UnderlyingClimate.set_hvac_mode"
) as mock_underlying_set_hvac_mode:
@@ -427,11 +427,11 @@ async def test_multiple_climates(
call.set_hvac_mode(HVACMode.HEAT),
]
)
assert entity._is_device_active is False # pylint: disable=protected-access
assert entity.is_device_active is False # pylint: disable=protected-access
# Stop heating, in boost mode. We block the control_heating to avoid running a cycle
with patch(
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat._async_control_heating"
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat.async_control_heating"
), patch(
"custom_components.versatile_thermostat.underlyings.UnderlyingClimate.set_hvac_mode"
) as mock_underlying_set_hvac_mode:
@@ -452,7 +452,7 @@ async def test_multiple_climates(
call.set_hvac_mode(HVACMode.OFF),
]
)
assert entity._is_device_active is False # pylint: disable=protected-access
assert entity.is_device_active is False # pylint: disable=protected-access
@pytest.mark.parametrize("expected_lingering_tasks", [True])
@@ -505,7 +505,7 @@ async def test_multiple_climates_underlying_changes(
# start heating, in boost mode. We block the control_heating to avoid running a cycle
with patch(
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat._async_control_heating"
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat.async_control_heating"
), patch(
"custom_components.versatile_thermostat.underlyings.UnderlyingClimate.set_hvac_mode"
) as mock_underlying_set_hvac_mode:
@@ -527,11 +527,11 @@ async def test_multiple_climates_underlying_changes(
call.set_hvac_mode(HVACMode.HEAT),
]
)
assert entity._is_device_active is False # pylint: disable=protected-access
assert entity.is_device_active is False # pylint: disable=protected-access
# Stop heating on one underlying climate
with patch(
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat._async_control_heating"
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat.async_control_heating"
), patch(
"custom_components.versatile_thermostat.underlyings.UnderlyingClimate.set_hvac_mode"
) as mock_underlying_set_hvac_mode:
@@ -554,11 +554,11 @@ async def test_multiple_climates_underlying_changes(
]
)
assert entity.hvac_mode == HVACMode.OFF
assert entity._is_device_active is False # pylint: disable=protected-access
assert entity.is_device_active is False # pylint: disable=protected-access
# Start heating on one underlying climate
with patch(
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat._async_control_heating"
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat.async_control_heating"
), patch(
"custom_components.versatile_thermostat.underlyings.UnderlyingClimate.set_hvac_mode"
) as mock_underlying_set_hvac_mode, patch(
@@ -587,4 +587,4 @@ async def test_multiple_climates_underlying_changes(
)
assert entity.hvac_mode == HVACMode.HEAT
assert entity.hvac_action == HVACAction.IDLE
assert entity._is_device_active is False # pylint: disable=protected-access
assert entity.is_device_active is False # pylint: disable=protected-access