예제 #1
0
    def test_hot_water_alone(self) -> None:
        """Test map hot water."""
        with open(path("files/responses/hotwater"), "r") as file:
            raw_hotwater = json.loads(file.read())

        hotwater = mapper.map_hot_water(raw_hotwater, "control_dhw")
        self.assertEqual("control_dhw", hotwater.id)
        self.assertEqual(OperatingModes.AUTO, hotwater.operating_mode)
        self.assertIsNotNone(hotwater.time_program.days["monday"].settings[0].setting)
예제 #2
0
    def test_no_hotwater(self) -> None:
        """Test map no hot water."""
        with open(path('files/responses/systemcontrol'), 'r') as file:
            raw_system = json.loads(file.read())

        raw_system['body']['dhw'] = []

        hot_water = mapper.map_hot_water(raw_system, {})
        self.assertIsNone(hot_water)
예제 #3
0
    def test_hot_water_no_current_temp(self) -> None:
        """Test map hot water no live report."""
        with open(path('files/responses/systemcontrol'), 'r') as file:
            raw_system = json.loads(file.read())

        hot_water = mapper.map_hot_water(raw_system, json.loads('{}'))
        self.assertEqual(None, hot_water.temperature)
        self.assertEqual(51, hot_water.target_high)
        self.assertEqual(OperatingModes.AUTO, hot_water.operating_mode)
        self.assertEqual("Control_DHW", hot_water.id)
예제 #4
0
    def test_hot_water(self) -> None:
        """Test map hot water."""
        with open(path('files/responses/systemcontrol'), 'r') as file:
            raw_system = json.loads(file.read())
        with open(path('files/responses/livereport'), 'r') as file:
            raw_livereport = json.loads(file.read())

        hot_water = mapper.map_hot_water(raw_system, raw_livereport)
        self.assertEqual(44.5, hot_water.temperature)
        self.assertEqual(51, hot_water.target_high)
        self.assertEqual(OperatingModes.AUTO, hot_water.operating_mode)
        self.assertEqual("Control_DHW", hot_water.id)
        self.assertIsNotNone(
            hot_water.time_program.days['monday'].settings[0].setting)
예제 #5
0
 def test_hot_water_alone_none(self) -> None:
     """Test map hot water."""
     hotwater = mapper.map_hot_water(None, "control_dhw")
     self.assertIsNone(hotwater)