|
1 | | -from time import strptime |
| 1 | +from datetime import datetime |
2 | 2 | from typing import List |
3 | 3 | from unittest import TestCase |
4 | 4 | from unittest.mock import patch |
@@ -104,7 +104,7 @@ def init(self, ClassMock, responses): |
104 | 104 | self.commander = ClassMock.return_value |
105 | 105 | self.commander.update.return_value = responses |
106 | 106 |
|
107 | | - self.cube = MaxCube("host", 1234) |
| 107 | + self.cube = MaxCube("host", 1234, now=lambda: datetime(2012, 10, 22, 5, 30)) |
108 | 108 |
|
109 | 109 | self.commander.update.assert_called_once() |
110 | 110 | self.commander.update.reset_mock() |
@@ -424,10 +424,7 @@ def test_get_device_as_dict(self, ClassMock): |
424 | 424 | ], |
425 | 425 | ) |
426 | 426 |
|
427 | | - @patch("maxcube.thermostat.localtime") |
428 | | - def test_set_auto_mode_read_temp_from_program(self, localtime_mock, ClassMock): |
429 | | - localtime_mock.return_value = strptime("2012-10-22T05:30", "%Y-%m-%dT%H:%M") |
430 | | - print(localtime_mock.return_value) |
| 427 | + def test_set_auto_mode_read_temp_from_program(self, ClassMock): |
431 | 428 | self.init(ClassMock, INIT_RESPONSE_2) |
432 | 429 | device = self.cube.devices[0] |
433 | 430 | self.assertEqual(8.0, device.target_temperature) |
|
0 commit comments