mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Remove duplicate tests in generic_thermostat (#105622)
Tests using `setup_comp_4` and `setup_comp_6` have been replaced by a parameterized tests in #105643. Tests using `setup_comp_5` are therefore still duplicates and are removed.
This commit is contained in:
parent
b99476284b
commit
7d44321f0f
@ -910,120 +910,6 @@ async def test_hvac_mode_change_toggles_heating_cooling_switch_even_when_within_
|
|||||||
assert call.data["entity_id"] == ENT_SWITCH
|
assert call.data["entity_id"] == ENT_SWITCH
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
async def setup_comp_5(hass):
|
|
||||||
"""Initialize components."""
|
|
||||||
hass.config.temperature_unit = UnitOfTemperature.CELSIUS
|
|
||||||
assert await async_setup_component(
|
|
||||||
hass,
|
|
||||||
DOMAIN,
|
|
||||||
{
|
|
||||||
"climate": {
|
|
||||||
"platform": "generic_thermostat",
|
|
||||||
"name": "test",
|
|
||||||
"cold_tolerance": 0.3,
|
|
||||||
"hot_tolerance": 0.3,
|
|
||||||
"heater": ENT_SWITCH,
|
|
||||||
"target_sensor": ENT_SENSOR,
|
|
||||||
"ac_mode": True,
|
|
||||||
"min_cycle_duration": datetime.timedelta(minutes=10),
|
|
||||||
"initial_hvac_mode": HVACMode.COOL,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
await hass.async_block_till_done()
|
|
||||||
|
|
||||||
|
|
||||||
async def test_temp_change_ac_trigger_on_not_long_enough_2(
|
|
||||||
hass: HomeAssistant, setup_comp_5
|
|
||||||
) -> None:
|
|
||||||
"""Test if temperature change turn ac on."""
|
|
||||||
calls = _setup_switch(hass, False)
|
|
||||||
await common.async_set_temperature(hass, 25)
|
|
||||||
_setup_sensor(hass, 30)
|
|
||||||
await hass.async_block_till_done()
|
|
||||||
assert len(calls) == 0
|
|
||||||
|
|
||||||
|
|
||||||
async def test_temp_change_ac_trigger_on_long_enough_2(
|
|
||||||
hass: HomeAssistant, setup_comp_5
|
|
||||||
) -> None:
|
|
||||||
"""Test if temperature change turn ac on."""
|
|
||||||
fake_changed = datetime.datetime(1970, 11, 11, 11, 11, 11, tzinfo=dt_util.UTC)
|
|
||||||
with freeze_time(fake_changed):
|
|
||||||
calls = _setup_switch(hass, False)
|
|
||||||
await common.async_set_temperature(hass, 25)
|
|
||||||
_setup_sensor(hass, 30)
|
|
||||||
await hass.async_block_till_done()
|
|
||||||
assert len(calls) == 1
|
|
||||||
call = calls[0]
|
|
||||||
assert call.domain == HASS_DOMAIN
|
|
||||||
assert call.service == SERVICE_TURN_ON
|
|
||||||
assert call.data["entity_id"] == ENT_SWITCH
|
|
||||||
|
|
||||||
|
|
||||||
async def test_temp_change_ac_trigger_off_not_long_enough_2(
|
|
||||||
hass: HomeAssistant, setup_comp_5
|
|
||||||
) -> None:
|
|
||||||
"""Test if temperature change turn ac on."""
|
|
||||||
calls = _setup_switch(hass, True)
|
|
||||||
await common.async_set_temperature(hass, 30)
|
|
||||||
_setup_sensor(hass, 25)
|
|
||||||
await hass.async_block_till_done()
|
|
||||||
assert len(calls) == 0
|
|
||||||
|
|
||||||
|
|
||||||
async def test_temp_change_ac_trigger_off_long_enough_2(
|
|
||||||
hass: HomeAssistant, setup_comp_5
|
|
||||||
) -> None:
|
|
||||||
"""Test if temperature change turn ac on."""
|
|
||||||
fake_changed = datetime.datetime(1970, 11, 11, 11, 11, 11, tzinfo=dt_util.UTC)
|
|
||||||
with freeze_time(fake_changed):
|
|
||||||
calls = _setup_switch(hass, True)
|
|
||||||
await common.async_set_temperature(hass, 30)
|
|
||||||
_setup_sensor(hass, 25)
|
|
||||||
await hass.async_block_till_done()
|
|
||||||
assert len(calls) == 1
|
|
||||||
call = calls[0]
|
|
||||||
assert call.domain == HASS_DOMAIN
|
|
||||||
assert call.service == SERVICE_TURN_OFF
|
|
||||||
assert call.data["entity_id"] == ENT_SWITCH
|
|
||||||
|
|
||||||
|
|
||||||
async def test_mode_change_ac_trigger_off_not_long_enough_2(
|
|
||||||
hass: HomeAssistant, setup_comp_5
|
|
||||||
) -> None:
|
|
||||||
"""Test if mode change turns ac off despite minimum cycle."""
|
|
||||||
calls = _setup_switch(hass, True)
|
|
||||||
await common.async_set_temperature(hass, 30)
|
|
||||||
_setup_sensor(hass, 25)
|
|
||||||
await hass.async_block_till_done()
|
|
||||||
assert len(calls) == 0
|
|
||||||
await common.async_set_hvac_mode(hass, HVACMode.OFF)
|
|
||||||
assert len(calls) == 1
|
|
||||||
call = calls[0]
|
|
||||||
assert call.domain == "homeassistant"
|
|
||||||
assert call.service == SERVICE_TURN_OFF
|
|
||||||
assert call.data["entity_id"] == ENT_SWITCH
|
|
||||||
|
|
||||||
|
|
||||||
async def test_mode_change_ac_trigger_on_not_long_enough_2(
|
|
||||||
hass: HomeAssistant, setup_comp_5
|
|
||||||
) -> None:
|
|
||||||
"""Test if mode change turns ac on despite minimum cycle."""
|
|
||||||
calls = _setup_switch(hass, False)
|
|
||||||
await common.async_set_temperature(hass, 25)
|
|
||||||
_setup_sensor(hass, 30)
|
|
||||||
await hass.async_block_till_done()
|
|
||||||
assert len(calls) == 0
|
|
||||||
await common.async_set_hvac_mode(hass, HVACMode.HEAT)
|
|
||||||
assert len(calls) == 1
|
|
||||||
call = calls[0]
|
|
||||||
assert call.domain == "homeassistant"
|
|
||||||
assert call.service == SERVICE_TURN_ON
|
|
||||||
assert call.data["entity_id"] == ENT_SWITCH
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
async def setup_comp_7(hass):
|
async def setup_comp_7(hass):
|
||||||
"""Initialize components."""
|
"""Initialize components."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user