mirror of
https://github.com/home-assistant/core.git
synced 2026-05-18 14:29:57 +01:00
a7fd763570
Co-authored-by: Robert Resch <robert@resch.dev> Co-authored-by: Norbert Rittel <norbert@rittel.de> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Owais Amin <141307092+owais-cielo@users.noreply.github.com> Co-authored-by: Owais Amin <owais@cielowigle.com> Co-authored-by: Maria Nadeem <maria@cielowigle.com>
36 lines
1006 B
Python
36 lines
1006 B
Python
"""Common tests for the Cielo Home climate."""
|
|
|
|
from unittest.mock import MagicMock
|
|
|
|
from homeassistant.const import UnitOfTemperature
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from tests.common import MockConfigEntry
|
|
|
|
|
|
async def test_climate_set_temperature_calls_library(
|
|
hass: HomeAssistant,
|
|
mock_cielo_client: MagicMock,
|
|
mock_config_entry: MockConfigEntry,
|
|
mock_cielo_device_api: MagicMock,
|
|
) -> None:
|
|
"""Test setting temperature calls into the library client/device API."""
|
|
mock_config_entry.add_to_hass(hass)
|
|
|
|
assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
|
await hass.async_block_till_done()
|
|
|
|
entity_id = "climate.living_room"
|
|
|
|
await hass.services.async_call(
|
|
"climate",
|
|
"set_temperature",
|
|
{"entity_id": entity_id, "temperature": 25},
|
|
blocking=True,
|
|
)
|
|
|
|
mock_cielo_device_api.async_set_temperature.assert_awaited_once_with(
|
|
UnitOfTemperature.CELSIUS,
|
|
temperature=25.0,
|
|
)
|