Add support for on/off climate (#25026)

* Add support for on/off climate

* address comments

* Add test for sync overwrite

* Add more tests
This commit is contained in:
Pascal Vizeli authored and Paulus Schoutsen committed 2019-07-11 15:28:11 -07:00
1 parent f5a4af40ee
commit d47905d119
5 files changed
+153 -56

No files matched your search

+25 -1
View File
@@ -1,9 +1,11 @@
"""The tests for the climate component."""
from unittest.mock import MagicMock
import pytest
import voluptuous as vol
from homeassistant.components.climate import SET_TEMPERATURE_SCHEMA
from homeassistant.components.climate import (
SET_TEMPERATURE_SCHEMA, ClimateDevice)
from tests.common import async_mock_service
@@ -37,3 +39,25 @@ async def test_set_temp_schema(hass, caplog):
assert len(calls) == 1
assert calls[-1].data == data
async def test_sync_turn_on(hass):
"""Test if adding turn_on work."""
climate = ClimateDevice()
climate.hass = hass
climate.turn_on = MagicMock()
await climate.async_turn_on()
assert climate.turn_on.called
async def test_sync_turn_off(hass):
"""Test if adding turn_on work."""
climate = ClimateDevice()
climate.hass = hass
climate.turn_off = MagicMock()
await climate.async_turn_off()
assert climate.turn_off.called