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)
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)
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)
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)
def test_hot_water_alone_none(self) -> None: """Test map hot water.""" hotwater = mapper.map_hot_water(None, "control_dhw") self.assertIsNone(hotwater)