Bring sensibo to full coverage (again) (#116469)

This commit is contained in:
G Johansson 2024-04-30 21:31:52 +02:00 committed by GitHub
parent c7a84b1c7b
commit 23a8b29bfe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -121,6 +121,32 @@ async def test_climate_fan(
state1 = hass.states.get("climate.hallway") state1 = hass.states.get("climate.hallway")
assert state1.attributes["fan_mode"] == "high" assert state1.attributes["fan_mode"] == "high"
monkeypatch.setattr(
get_data.parsed["ABC999111"],
"fan_modes",
["quiet", "low", "medium", "not_in_ha"],
)
monkeypatch.setattr(
get_data.parsed["ABC999111"],
"fan_modes_translated",
{
"low": "low",
"medium": "medium",
"quiet": "quiet",
"not_in_ha": "not_in_ha",
},
)
with pytest.raises(
HomeAssistantError,
match="Climate fan mode not_in_ha is not supported by the integration",
):
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_FAN_MODE,
{ATTR_ENTITY_ID: state1.entity_id, ATTR_FAN_MODE: "not_in_ha"},
blocking=True,
)
with ( with (
patch( patch(
"homeassistant.components.sensibo.coordinator.SensiboClient.async_get_devices_data", "homeassistant.components.sensibo.coordinator.SensiboClient.async_get_devices_data",
@ -194,6 +220,42 @@ async def test_climate_swing(
state1 = hass.states.get("climate.hallway") state1 = hass.states.get("climate.hallway")
assert state1.attributes["swing_mode"] == "stopped" assert state1.attributes["swing_mode"] == "stopped"
monkeypatch.setattr(
get_data.parsed["ABC999111"],
"swing_modes",
["stopped", "fixedtop", "fixedmiddletop", "not_in_ha"],
)
monkeypatch.setattr(
get_data.parsed["ABC999111"],
"swing_modes_translated",
{
"fixedmiddletop": "fixedMiddleTop",
"fixedtop": "fixedTop",
"stopped": "stopped",
"not_in_ha": "not_in_ha",
},
)
with patch(
"homeassistant.components.sensibo.coordinator.SensiboClient.async_get_devices_data",
return_value=get_data,
):
async_fire_time_changed(
hass,
dt_util.utcnow() + timedelta(minutes=5),
)
await hass.async_block_till_done()
with pytest.raises(
HomeAssistantError,
match="Climate swing mode not_in_ha is not supported by the integration",
):
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_SWING_MODE,
{ATTR_ENTITY_ID: state1.entity_id, ATTR_SWING_MODE: "not_in_ha"},
blocking=True,
)
with ( with (
patch( patch(
"homeassistant.components.sensibo.coordinator.SensiboClient.async_get_devices_data", "homeassistant.components.sensibo.coordinator.SensiboClient.async_get_devices_data",