Exemplo n.º 1
0
    def test_map_no_quick_mode(self) -> None:
        """Test map no quick mode."""
        with open(path('files/responses/systemcontrol'), 'r') as file:
            system = json.loads(file.read())

        quick_mode = mapper.map_quick_mode(system)
        self.assertIsNone(quick_mode)
Exemplo n.º 2
0
    def test_map_quick_mode(self) -> None:
        """Test map quick mode."""
        with open(path("files/responses/systemcontrol_hotwater_boost"),
                  'r') as file:
            system = json.loads(file.read())

        quick_mode = mapper.map_quick_mode(system)
        self.assertEqual(QuickModes.HOTWATER_BOOST.name, quick_mode.name)
Exemplo n.º 3
0
    def test_map_quick_mode_quick_veto(self) -> None:
        """Test map quick veto."""
        with open(path("files/responses/systemcontrol_quick_veto"),
                  'r') as file:
            system = json.loads(file.read())

        quick_mode = mapper.map_quick_mode(system)
        self.assertIsNone(quick_mode)
Exemplo n.º 4
0
    def test_holiday_mode(self) -> None:
        """Test map holiday mode."""
        with open(path('files/responses/systemcontrol_holiday'), 'r')\
                as file:
            raw_system = json.loads(file.read())

        holiday_mode = mapper.map_holiday_mode(raw_system)
        quick_mode = mapper.map_quick_mode(raw_system)
        self.assertEqual(QuickModes.HOLIDAY, quick_mode)
        self.assertIsNotNone(holiday_mode)
        self.assertTrue(holiday_mode.is_active)
        self.assertEqual(date(2019, 1, 2), holiday_mode.start_date)
        self.assertEqual(date(2019, 1, 3), holiday_mode.end_date)
        self.assertEqual(15, holiday_mode.target)
Exemplo n.º 5
0
 def test_map_quick_mode_no_duration(self) -> None:
     with open(path("files/responses/quick_mode_no_duration"), "r") as file:
         json_raw = json.loads(file.read())
         q_m = mapper.map_quick_mode(json_raw)
         self.assertEqual(QuickModes.SYSTEM_OFF, q_m)
         self.assertIsNone(q_m.duration)