Ejemplo n.º 1
0
 def test_03_All(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_in_xml = self.m_xml.light
     l_device = self.m_device_obj
     l_light = LightingCoreAPI.read_core_lighting_xml(l_device, l_in_xml, self.m_version)
     FamUtil.read_family_data(self.m_pyhouse_obj, l_light, l_in_xml)
     l_out_xml = LightingCoreAPI.write_core_lighting_xml("Light", l_light)
     FamUtil.write_family_data(self.m_pyhouse_obj, l_out_xml, l_light)
     self.assertEqual(l_light.Name, TESTING_LIGHTING_LIGHTS_NAME_1)
     self.assertEqual(l_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_light.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Ejemplo n.º 2
0
 def test_02_All(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_in_xml = self.m_xml.light
     l_device = self.m_device_obj
     l_light = LightingCoreAPI.read_core_lighting_xml(
         self.m_pyhouse_obj, l_device, l_in_xml)
     FamUtil.read_family_data(self.m_pyhouse_obj, l_light, l_in_xml)
     l_out_xml = LightingCoreAPI.write_core_lighting_xml('Light', l_light)
     FamUtil.write_family_data(self.m_pyhouse_obj, l_out_xml, l_light)
     self.assertEqual(l_light.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(l_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_light.InsteonAddress,
                      conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Ejemplo n.º 3
0
 def test_01_Interface(self):
     l_ctlr = self.m_xml.controller_sect[1]
     l_device = ControllerData()
     l_obj = lightingcoreAPI.read_core_lighting_xml(l_device, l_ctlr, self.m_version)
     L_interface = usbXML.read_interface_xml(l_ctlr)
     stuff_new_attrs(l_obj, L_interface)
     #
     l_xml = lightingcoreAPI.write_core_lighting_xml('TestController', l_obj)
     usbXML.write_interface_xml(l_xml, l_obj)
     print(PrettyFormatAny.form(l_xml, 'XML'))
     self.assertEqual(l_xml.attrib['Name'], TESTING_CONTROLLER_NAME_1)
     self.assertEqual(l_xml.attrib['Key'], TESTING_CONTROLLER_KEY_1)
     self.assertEqual(l_xml.attrib['Active'], TESTING_CONTROLLER_ACTIVE_1)
     self.assertEqual(l_xml.find('Vendor').text, TESTING_USB_VENDOR)
     self.assertEqual(l_xml.find('Product').text, TESTING_USB_PRODUCT)
Ejemplo n.º 4
0
 def setUp(self):
     SetupMixin.setUp(self, ET.fromstring(XML_LONG))
     self.m_device_obj.DeviceFamily = TESTING_DEVICE_FAMILY_INSTEON
     self.m_api = FamUtil._get_family_device_api(self.m_pyhouse_obj,
                                                 self.m_device_obj)
     self.m_light = LightingCoreAPI.read_core_lighting_xml(
         self.m_pyhouse_obj, self.m_device_obj, self.m_xml.controller)
Ejemplo n.º 5
0
 def _read_base_device(p_pyhouse_obj, p_xml):
     """
     @param p_xml: is the XML Element for the entire device
     @return: a Light data object with the base info filled in
     """
     l_obj = LightData()
     l_obj = LightingCoreAPI.read_core_lighting_xml(p_pyhouse_obj, l_obj, p_xml)
     return l_obj
Ejemplo n.º 6
0
 def test_01_Interface(self):
     l_ctlr = self.m_xml.controller_sect[1]
     l_device = ControllerData()
     l_obj = lightingcoreAPI.read_core_lighting_xml(l_device, l_ctlr,
                                                    self.m_version)
     L_interface = usbXML.read_interface_xml(l_ctlr)
     stuff_new_attrs(l_obj, L_interface)
     #
     l_xml = lightingcoreAPI.write_core_lighting_xml(
         'TestController', l_obj)
     usbXML.write_interface_xml(l_xml, l_obj)
     print(PrettyFormatAny.form(l_xml, 'XML'))
     self.assertEqual(l_xml.attrib['Name'], TESTING_CONTROLLER_NAME_1)
     self.assertEqual(l_xml.attrib['Key'], TESTING_CONTROLLER_KEY_1)
     self.assertEqual(l_xml.attrib['Active'], TESTING_CONTROLLER_ACTIVE_1)
     self.assertEqual(l_xml.find('Vendor').text, TESTING_USB_VENDOR)
     self.assertEqual(l_xml.find('Product').text, TESTING_USB_PRODUCT)
Ejemplo n.º 7
0
 def test_05_Light(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light
     l_device = self.m_device_obj
     l_light = LightingCoreAPI.read_core_lighting_xml(l_device, l_xml, self.m_version)
     self.assertEqual(l_light.Name, TESTING_LIGHTING_LIGHTS_NAME_1)
     self.assertEqual(l_device.RoomName, TESTING_DEVICE_ROOM_NAME)
Ejemplo n.º 8
0
 def test_04_Light(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light
     l_device = self.m_device_obj
     l_light = LightingCoreAPI.read_core_lighting_xml(
         self.m_pyhouse_obj, l_device, l_xml)
     print(PrettyFormatAny.form(l_light, 'Light'))
     self.assertEqual(l_light.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(l_device.RoomName, TESTING_DEVICE_ROOM_NAME)
Ejemplo n.º 9
0
 def test_01_Interface(self):
     l_ctlr = self.m_xml.controller_sect[1]
     l_device = ControllerData()
     l_obj = lightingcoreAPI.read_core_lighting_xml(l_device, l_ctlr, self.m_version)
     print(PrettyFormatAny.form(l_obj, 'L L'))
     L_interface = usbXML.read_interface_xml(l_ctlr)
     stuff_new_attrs(l_obj, L_interface)
     print(PrettyFormatAny.form(l_obj, 'L L'))
     self.assertEqual(l_obj.Vendor, int(TESTING_USB_VENDOR))
     self.assertEqual(l_obj.Product, int(TESTING_USB_PRODUCT))
Ejemplo n.º 10
0
 def _read_base_device(p_xml, p_version):
     """
     @param p_xml: is the XML Element for the entire device
     @param p_version: is some helper data to get the correct information from the config file.
     @return: a Controller data object with the base info filled in
     """
     l_obj = ControllerData()  # Create an empty controller object.
     l_obj = LightingCoreAPI.read_core_lighting_xml(l_obj, p_xml, p_version)
     # l_obj.DeviceSubType = 1
     return l_obj
Ejemplo n.º 11
0
 def test_01_Interface(self):
     l_ctlr = self.m_xml.controller_sect[1]
     l_device = ControllerData()
     l_obj = lightingcoreAPI.read_core_lighting_xml(l_device, l_ctlr,
                                                    self.m_version)
     print(PrettyFormatAny.form(l_obj, 'L L'))
     L_interface = usbXML.read_interface_xml(l_ctlr)
     stuff_new_attrs(l_obj, L_interface)
     print(PrettyFormatAny.form(l_obj, 'L L'))
     self.assertEqual(l_obj.Vendor, int(TESTING_USB_VENDOR))
     self.assertEqual(l_obj.Product, int(TESTING_USB_PRODUCT))
Ejemplo n.º 12
0
 def _read_base_device(p_pyhouse_obj, p_xml):
     """
     @param p_xml: is the XML Element for the entire device
     @param p_version: is some helper data to get the correct information from the config file.
     @return: a Controller data object with the base info filled in
     """
     l_obj = ControllerData()  # Create an empty controller object.
     l_obj = LightingCoreAPI.read_core_lighting_xml(p_pyhouse_obj, l_obj,
                                                    p_xml)
     #  l_obj.DeviceSubType = 1
     return l_obj
Ejemplo n.º 13
0
 def test_06_All(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light
     l_device = self.m_device_obj
     #
     l_light = LightingCoreAPI.read_core_lighting_xml(l_device, l_xml, self.m_version)
     FamUtil.read_family_data(self.m_pyhouse_obj, l_light, l_xml)
     self.assertEqual(l_light.Name, TESTING_LIGHTING_LIGHTS_NAME_1)
     self.assertEqual(l_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_light.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
     self.assertEqual(l_light.DevCat, conversions.dotted_hex2int(TESTING_INSTEON_DEVCAT_0))
     self.assertEqual(conversions.int2dotted_hex(l_light.ProductKey, 3), TESTING_INSTEON_PRODUCT_KEY_0)
Ejemplo n.º 14
0
 def test_05_All(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light
     l_device = self.m_device_obj
     #
     l_light = LightingCoreAPI.read_core_lighting_xml(
         self.m_pyhouse_obj, l_device, l_xml)
     FamUtil.read_family_data(self.m_pyhouse_obj, l_light, l_xml)
     print(PrettyFormatAny.form(l_light, 'Light'))
     self.assertEqual(l_light.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(l_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_light.InsteonAddress,
                      conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
     self.assertEqual(l_light.DevCat,
                      conversions.dotted_hex2int(TESTING_INSTEON_DEVCAT_0))
     self.assertEqual(conversions.int2dotted_hex(l_light.ProductKey, 3),
                      TESTING_INSTEON_PRODUCT_KEY_0)
Ejemplo n.º 15
0
 def _write_base_device(_p_pyhouse_obj, p_light_obj):
     l_xml = LightingCoreAPI.write_core_lighting_xml('Light', p_light_obj)
     return l_xml
Ejemplo n.º 16
0
 def _write_base_device(p_obj):
     l_xml = LightingCoreAPI.write_core_lighting_xml('Controller', p_obj)
     return l_xml
Ejemplo n.º 17
0
 def _write_base_device(p_obj):
     l_xml = LightingCoreAPI.write_core_lighting_xml('Controller', p_obj)
     return l_xml
Ejemplo n.º 18
0
 def _write_base_device(p_obj):
     l_xml = LightingCoreAPI.write_core_lighting_xml('Button', p_obj)
     return l_xml
Ejemplo n.º 19
0
 def setUp(self):
     SetupMixin.setUp(self, ET.fromstring(XML_LONG))
     self.m_device_obj.DeviceFamily = TESTING_DEVICE_FAMILY_INSTEON
     self.m_api = FamUtil._get_family_device_api(self.m_pyhouse_obj, self.m_device_obj)
     self.m_light = LightingCoreAPI.read_core_lighting_xml(self.m_device_obj, self.m_xml.controller, self.m_version)
Ejemplo n.º 20
0
 def _write_base_device(p_pyhouse_obj, p_light_obj):
     l_xml = LightingCoreAPI.write_core_lighting_xml('Light', p_light_obj)
     return l_xml