Change Climate set temp action for incorrect feature will raise (#126692)

* Change Climate set temp action for incorrect feature will raise

* Fix some tests

* Fix review comments

* Fix tesla_fleet

* Fix tests

* Fix review comment
This commit is contained in:
G Johansson
2024-09-25 21:16:14 +02:00
committed by GitHub
parent 9afd270111
commit c6a1b9fc39
13 changed files with 85 additions and 166 deletions

View File

@@ -5,6 +5,7 @@ from unittest.mock import patch
from pypck.inputs import ModStatusVar, Unknown
from pypck.lcn_addr import LcnAddr
from pypck.lcn_defs import Var, VarUnit, VarValue
import pytest
from syrupy.assertion import SnapshotAssertion
from homeassistant.components.climate import (
@@ -25,6 +26,7 @@ from homeassistant.const import (
Platform,
)
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ServiceValidationError
from homeassistant.helpers import entity_registry as er
from .conftest import MockConfigEntry, MockModuleConnection, init_integration
@@ -140,16 +142,17 @@ async def test_set_temperature(hass: HomeAssistant, entry: MockConfigEntry) -> N
# wrong temperature set via service call with high/low attributes
var_abs.return_value = False
await hass.services.async_call(
DOMAIN_CLIMATE,
SERVICE_SET_TEMPERATURE,
{
ATTR_ENTITY_ID: "climate.climate1",
ATTR_TARGET_TEMP_LOW: 24.5,
ATTR_TARGET_TEMP_HIGH: 25.5,
},
blocking=True,
)
with pytest.raises(ServiceValidationError):
await hass.services.async_call(
DOMAIN_CLIMATE,
SERVICE_SET_TEMPERATURE,
{
ATTR_ENTITY_ID: "climate.climate1",
ATTR_TARGET_TEMP_LOW: 24.5,
ATTR_TARGET_TEMP_HIGH: 25.5,
},
blocking=True,
)
var_abs.assert_not_awaited()