add ability to resume program... and add in a forgotten test
This commit is contained in:
parent
5fe2db228c
commit
37be81c20c
2 changed files with 33 additions and 0 deletions
|
@ -175,6 +175,11 @@ class NuHeatThermostat(ClimateDevice):
|
||||||
if not self.is_away_mode_on:
|
if not self.is_away_mode_on:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
self.resume_program()
|
||||||
|
self._force_update = True
|
||||||
|
|
||||||
|
def resume_program(self):
|
||||||
|
"""Resume the thermostat's programmed schedule."""
|
||||||
self._thermostat.resume_schedule()
|
self._thermostat.resume_schedule()
|
||||||
self._force_update = True
|
self._force_update = True
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,8 @@ class TestNuHeat(unittest.TestCase):
|
||||||
target_celsius=22,
|
target_celsius=22,
|
||||||
target_fahrenheit=72)
|
target_fahrenheit=72)
|
||||||
|
|
||||||
|
thermostat.resume_schedule = Mock()
|
||||||
|
|
||||||
api = Mock()
|
api = Mock()
|
||||||
api.get_thermostat.return_value = thermostat
|
api.get_thermostat.return_value = thermostat
|
||||||
|
|
||||||
|
@ -171,6 +173,32 @@ class TestNuHeat(unittest.TestCase):
|
||||||
self.thermostat.turn_away_mode_on()
|
self.thermostat.turn_away_mode_on()
|
||||||
set_temp.assert_not_called()
|
set_temp.assert_not_called()
|
||||||
|
|
||||||
|
@patch.object(
|
||||||
|
nuheat.NuHeatThermostat, "is_away_mode_on", new_callable=PropertyMock)
|
||||||
|
@patch.object(nuheat.NuHeatThermostat, "resume_program")
|
||||||
|
def test_turn_away_mode_off_home(self, resume, is_away_mode_on):
|
||||||
|
"""Test turn away mode off when home."""
|
||||||
|
is_away_mode_on.return_value = False
|
||||||
|
self.thermostat.turn_away_mode_off()
|
||||||
|
self.assertFalse(self.thermostat._force_update)
|
||||||
|
resume.assert_not_called()
|
||||||
|
|
||||||
|
@patch.object(
|
||||||
|
nuheat.NuHeatThermostat, "is_away_mode_on", new_callable=PropertyMock)
|
||||||
|
@patch.object(nuheat.NuHeatThermostat, "resume_program")
|
||||||
|
def test_turn_away_mode_off_away(self, resume, is_away_mode_on):
|
||||||
|
"""Test turn away mode off when away."""
|
||||||
|
is_away_mode_on.return_value = True
|
||||||
|
self.thermostat.turn_away_mode_off()
|
||||||
|
self.assertTrue(self.thermostat._force_update)
|
||||||
|
resume.assert_called_once()
|
||||||
|
|
||||||
|
def test_resume_program(self):
|
||||||
|
"""Test resume schedule."""
|
||||||
|
self.thermostat.resume_program()
|
||||||
|
self.thermostat._thermostat.resume_schedule.assert_called_once()
|
||||||
|
self.assertTrue(self.thermostat._force_update)
|
||||||
|
|
||||||
def test_set_temperature(self):
|
def test_set_temperature(self):
|
||||||
"""Test set temperature."""
|
"""Test set temperature."""
|
||||||
self.thermostat.set_temperature(temperature=85)
|
self.thermostat.set_temperature(temperature=85)
|
||||||
|
|
Loading…
Add table
Reference in a new issue