mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Migrate homekit tests to use unit system (#140372)
This commit is contained in:
parent
0e7a083847
commit
1c242a6602
@ -69,7 +69,6 @@ from homeassistant.const import (
|
|||||||
ATTR_FRIENDLY_NAME,
|
ATTR_FRIENDLY_NAME,
|
||||||
ATTR_SUPPORTED_FEATURES,
|
ATTR_SUPPORTED_FEATURES,
|
||||||
ATTR_TEMPERATURE,
|
ATTR_TEMPERATURE,
|
||||||
CONF_TEMPERATURE_UNIT,
|
|
||||||
EVENT_HOMEASSISTANT_START,
|
EVENT_HOMEASSISTANT_START,
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
@ -77,6 +76,7 @@ from homeassistant.const import (
|
|||||||
)
|
)
|
||||||
from homeassistant.core import CoreState, Event, HomeAssistant
|
from homeassistant.core import CoreState, Event, HomeAssistant
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
from homeassistant.util.unit_system import US_CUSTOMARY_SYSTEM
|
||||||
|
|
||||||
from tests.common import async_mock_service
|
from tests.common import async_mock_service
|
||||||
|
|
||||||
@ -858,6 +858,7 @@ async def test_thermostat_fahrenheit(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Test if accessory and HA are updated accordingly."""
|
"""Test if accessory and HA are updated accordingly."""
|
||||||
entity_id = "climate.test"
|
entity_id = "climate.test"
|
||||||
|
hass.config.units = US_CUSTOMARY_SYSTEM
|
||||||
|
|
||||||
# support_ = True
|
# support_ = True
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
@ -869,10 +870,7 @@ async def test_thermostat_fahrenheit(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
with patch.object(
|
acc = Thermostat(hass, hk_driver, "Climate", entity_id, 1, None)
|
||||||
hass.config.units, CONF_TEMPERATURE_UNIT, new=UnitOfTemperature.FAHRENHEIT
|
|
||||||
):
|
|
||||||
acc = Thermostat(hass, hk_driver, "Climate", entity_id, 1, None)
|
|
||||||
hk_driver.add_accessory(acc)
|
hk_driver.add_accessory(acc)
|
||||||
acc.run()
|
acc.run()
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
@ -1786,13 +1784,11 @@ async def test_water_heater_fahrenheit(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Test if accessory and HA are update accordingly."""
|
"""Test if accessory and HA are update accordingly."""
|
||||||
entity_id = "water_heater.test"
|
entity_id = "water_heater.test"
|
||||||
|
hass.config.units = US_CUSTOMARY_SYSTEM
|
||||||
|
|
||||||
hass.states.async_set(entity_id, HVACMode.HEAT)
|
hass.states.async_set(entity_id, HVACMode.HEAT)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
with patch.object(
|
acc = WaterHeater(hass, hk_driver, "WaterHeater", entity_id, 2, None)
|
||||||
hass.config.units, CONF_TEMPERATURE_UNIT, new=UnitOfTemperature.FAHRENHEIT
|
|
||||||
):
|
|
||||||
acc = WaterHeater(hass, hk_driver, "WaterHeater", entity_id, 2, None)
|
|
||||||
acc.run()
|
acc.run()
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user