Example #1
0
class TestThermostat(TestCase):
    def setUp(self):
        self.thermostat = Thermostat(_mac=None, connection_cls=FakeConnection)

    def test__verify_temperature(self):
        with self.assertRaises(TemperatureException):
            self.thermostat._verify_temperature(-1)
        with self.assertRaises(TemperatureException):
            self.thermostat._verify_temperature(35)

        self.thermostat._verify_temperature(8)
        self.thermostat._verify_temperature(25)

    def test_parse_schedule(self):
        self.fail()

    def test_handle_notification(self):
        self.fail()

    def test_query_id(self):
        self.thermostat.query_id()
        self.assertEqual(self.thermostat.firmware_version, 120)
        self.assertEqual(self.thermostat.device_serial, "PEQ2130075")

    def test_update(self):
        th = self.thermostat

        th._conn.set_status('auto')
        th.update()
        self.assertEqual(th.valve_state, 0)
        self.assertEqual(th.mode, Mode.Auto)
        self.assertEqual(th.target_temperature, 20.0)
        self.assertFalse(th.locked)
        self.assertFalse(th.low_battery)
        self.assertFalse(th.boost)
        self.assertFalse(th.window_open)

        th._conn.set_status('manual')
        th.update()
        self.assertTrue(th.mode, Mode.Manual)

        th._conn.set_status('away')
        th.update()
        self.assertEqual(th.mode, Mode.Away)
        self.assertEqual(th.target_temperature, 17.5)
        self.assertEqual(th.away_end, datetime(2019, 3, 29, 23, 00))

        th._conn.set_status('boost')
        th.update()
        self.assertTrue(th.boost)
        self.assertEqual(th.mode, Mode.Boost)

    def test_presets(self):
        th = self.thermostat
        self.thermostat._conn.set_status('presets')
        self.thermostat.update()
        self.assertEqual(th.window_open_temperature, 12.0)
        self.assertEqual(th.window_open_time, timedelta(minutes=15.0))
        self.assertEqual(th.comfort_temperature, 20.0)
        self.assertEqual(th.eco_temperature, 17.0)
        self.assertEqual(th.temperature_offset, 0)

    def test_query_schedule(self):
        self.fail()

    def test_schedule(self):
        self.fail()

    def test_set_schedule(self):
        self.fail()

    def test_target_temperature(self):
        self.fail()

    def test_mode(self):
        self.fail()

    def test_mode_readable(self):
        self.fail()

    def test_boost(self):
        self.fail()

    def test_valve_state(self):
        th = self.thermostat
        th._conn.set_status('valve_at_22')
        th.update()
        self.assertEqual(th.valve_state, 22)

    def test_window_open(self):
        th = self.thermostat
        th._conn.set_status('window')
        th.update()
        self.assertTrue(th.window_open)

    def test_window_open_config(self):
        self.fail()

    def test_locked(self):
        self.fail()

    def test_low_battery(self):
        th = self.thermostat
        th._conn.set_status('low_batt')
        th.update()
        self.assertTrue(th.low_battery)

    def test_temperature_offset(self):
        self.fail()

    def test_activate_comfort(self):
        self.fail()

    def test_activate_eco(self):
        self.fail()

    def test_min_temp(self):
        self.fail()

    def test_max_temp(self):
        self.fail()

    def test_away_end(self):
        self.fail()

    def test_decode_mode(self):
        self.fail()
Example #2
0
class TestThermostat(TestCase):
    def setUp(self):
        self.thermostat = Thermostat(_mac=None, connection_cls=FakeConnection)

    def test__verify_temperature(self):
        with self.assertRaises(TemperatureException):
            self.thermostat._verify_temperature(-1)
        with self.assertRaises(TemperatureException):
            self.thermostat._verify_temperature(35)

        self.thermostat._verify_temperature(8)
        self.thermostat._verify_temperature(25)

    def test_parse_schedule(self):
        self.fail()

    def test_handle_notification(self):
        self.fail()

    def test_update(self):
        self.fail()

    def test_query_schedule(self):
        self.fail()

    def test_schedule(self):
        self.fail()

    def test_set_schedule(self):
        self.fail()

    def test_target_temperature(self):
        self.fail()

    def test_mode(self):
        self.fail()

    def test_mode_readable(self):
        self.fail()

    def test_boost(self):
        self.fail()

    def test_valve_state(self):
        self.fail()

    def test_window_open(self):
        self.fail()

    def test_window_open_config(self):
        self.fail()

    def test_locked(self):
        self.fail()

    def test_low_battery(self):
        self.fail()

    def test_temperature_offset(self):
        self.fail()

    def test_activate_comfort(self):
        self.fail()

    def test_activate_eco(self):
        self.fail()

    def test_min_temp(self):
        self.fail()

    def test_max_temp(self):
        self.fail()

    def test_away_end(self):
        self.fail()

    def test_decode_mode(self):
        self.fail()