def test_02_Controller(self): """Read Controller 0 Serial """ l_obj = Utility._read_base_device(self.m_xml.controller, self.m_version) l_obj = Utility._read_controller_data(l_obj, self.m_xml.controller, self.m_version) self.assertEqual(l_obj.InterfaceType, TESTING_INTERFACE_TYPE_SERIAL) self.assertEqual(l_obj.Port, TESTING_INTERFACE_PORT_SERIAL)
def test_02_Controller(self): """ Write out the XML file for the Base + Controller """ l_controllers = self.m_api.read_all_controllers_xml(self.m_pyhouse_obj, self.m_xml.controller_sect, self.m_version) l_xml = Utility._write_base_device(l_controllers[0]) Utility._write_controller_data(l_controllers[0], l_xml) self.assertEqual(l_xml.find('InterfaceType').text, TESTING_INTERFACE_TYPE_SERIAL) self.assertEqual(l_xml.find('Port').text, TESTING_INTERFACE_PORT_SERIAL)
def test_02_Controller(self): """Read Controller 0 Serial """ l_xml = self.m_xml.controller l_obj = Utility._read_base_device(self.m_pyhouse_obj, l_xml) l_obj = Utility._read_controller_data(self.m_pyhouse_obj, l_obj, l_xml) # print(PrettyFormatAny.form(l_obj, 'B1-2-A - AllControllers')) self.assertEqual(l_obj.InterfaceType, TESTING_INTERFACE_TYPE_SERIAL) self.assertEqual(l_obj.Port, TESTING_INTERFACE_PORT_SERIAL)
def test_02_Controller(self): """ Write out the XML file for the Base + Controller """ l_controllers = self.m_api.read_all_controllers_xml(self.m_pyhouse_obj) l_xml = Utility._write_base_device(l_controllers[0]) Utility._write_controller_data(l_controllers[0], l_xml) # print(PrettyFormatAny.form(l_xml, 'Base')) self.assertEqual(l_xml.find('InterfaceType').text, TESTING_INTERFACE_TYPE_SERIAL) self.assertEqual(l_xml.find('Port').text, TESTING_INTERFACE_PORT_SERIAL)
def test_03_Interface(self): """Read Controller Interface. """ l_obj = Utility._read_base_device(self.m_xml.controller, self.m_version) Utility._read_controller_data(l_obj, self.m_xml.controller, self.m_version) Utility._read_interface_data(l_obj, self.m_xml.controller, self.m_version) self.assertEqual(l_obj.BaudRate, int(TESTING_SERIAL_BAUD_RATE)) self.assertEqual(l_obj.ByteSize, int(TESTING_SERIAL_BYTE_SIZE)) self.assertEqual(l_obj.Parity, TESTING_SERIAL_PARITY) self.assertEqual(l_obj.RtsCts, TESTING_SERIAL_RTS_CTS == 'True') self.assertEqual(l_obj.StopBits, float(TESTING_SERIAL_STOP_BITS)) self.assertEqual(l_obj.Timeout, float(TESTING_SERIAL_TIMEOUT)) self.assertEqual(l_obj.XonXoff, TESTING_SERIAL_XON_XOFF == 'True')
def test_03_Interface(self): """Read Controller Interface. """ l_xml = self.m_xml.controller l_obj = Utility._read_base_device(self.m_pyhouse_obj, l_xml) l_obj = Utility._read_controller_data(self.m_pyhouse_obj, l_obj, l_xml) Utility._read_interface_data(self.m_pyhouse_obj, l_obj, l_xml) self.assertEqual(l_obj.BaudRate, int(TESTING_SERIAL_BAUD_RATE)) self.assertEqual(l_obj.ByteSize, int(TESTING_SERIAL_BYTE_SIZE)) self.assertEqual(l_obj.Parity, TESTING_SERIAL_PARITY) self.assertEqual(l_obj.RtsCts, TESTING_SERIAL_RTS_CTS == 'True') self.assertEqual(l_obj.StopBits, float(TESTING_SERIAL_STOP_BITS)) self.assertEqual(l_obj.Timeout, float(TESTING_SERIAL_TIMEOUT)) self.assertEqual(l_obj.XonXoff, TESTING_SERIAL_XON_XOFF == 'True')
def test_03_Interface(self): """ Write out the XML file for the location section """ l_controllers = self.m_api.read_all_controllers_xml(self.m_pyhouse_obj) l_xml = Utility._write_base_device(l_controllers[0]) Utility._write_controller_data(l_controllers[0], l_xml) Utility._write_interface_data(l_controllers[0], l_xml) print(PrettyFormatAny.form(l_xml, 'C1-03-A - w/ Interface', 100)) self.assertEqual(l_xml.find('BaudRate').text, TESTING_SERIAL_BAUD_RATE) self.assertEqual(l_xml.find('ByteSize').text, TESTING_SERIAL_BYTE_SIZE) self.assertEqual(l_xml.find('Parity').text, TESTING_SERIAL_PARITY) self.assertEqual(l_xml.find('RtsCts').text, TESTING_SERIAL_RTS_CTS) self.assertEqual(l_xml.find('StopBits').text, TESTING_SERIAL_STOP_BITS) self.assertEqual(l_xml.find('Timeout').text, TESTING_SERIAL_TIMEOUT) self.assertEqual(l_xml.find('XonXoff').text, TESTING_SERIAL_XON_XOFF)
def test_03_Interface(self): """ Write out the XML file for the location section """ l_controllers = self.m_api.read_all_controllers_xml(self.m_pyhouse_obj, self.m_xml.controller_sect, self.m_version) # print(PrettyFormatAny.form(l_controllers[0], 'Obj Controllers', 100)) l_xml = Utility._write_base_device(l_controllers[0]) Utility._write_controller_data(l_controllers[0], l_xml) Utility._write_interface_data(l_controllers[0], l_xml) # print(PrettyFormatAny.form(l_xml, 'AllControllers', 100)) self.assertEqual(l_xml.find('BaudRate').text, TESTING_SERIAL_BAUD_RATE) self.assertEqual(l_xml.find('ByteSize').text, TESTING_SERIAL_BYTE_SIZE) self.assertEqual(l_xml.find('Parity').text, TESTING_SERIAL_PARITY) self.assertEqual(l_xml.find('RtsCts').text, TESTING_SERIAL_RTS_CTS) self.assertEqual(l_xml.find('StopBits').text, TESTING_SERIAL_STOP_BITS) self.assertEqual(l_xml.find('Timeout').text, TESTING_SERIAL_TIMEOUT) self.assertEqual(l_xml.find('XonXoff').text, TESTING_SERIAL_XON_XOFF)
def test_06_OneController(self): """ Read in the xml file and fill in the lights """ l_obj = Utility._read_one_controller_xml(self.m_pyhouse_obj, self.m_xml.controller) print(PrettyFormatAny.form(l_obj, 'B1-06-A - OneController', 100)) self.assertEqual(l_obj.Name, TESTING_CONTROLLER_NAME_0) self.assertEqual(l_obj.Active, (TESTING_CONTROLLER_ACTIVE_0 == 'True')) self.assertEqual(l_obj.LightingType, TESTING_CONTROLLER_TYPE_0) self.assertEqual(l_obj.Comment, TESTING_DEVICE_COMMENT) self.assertEqual(l_obj.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON) self.assertEqual(l_obj.DeviceType, int(TESTING_DEVICE_TYPE)) self.assertEqual(l_obj.DeviceSubType, int(TESTING_DEVICE_SUBTYPE)) self.assertEqual(l_obj.RoomName, TESTING_DEVICE_ROOM_NAME) self.assertEqual(l_obj.InterfaceType, TESTING_INTERFACE_TYPE_SERIAL) self.assertEqual(l_obj.Port, TESTING_INTERFACE_PORT_SERIAL) self.assertEqual(l_obj.BaudRate, int(TESTING_SERIAL_BAUD_RATE)) self.assertEqual(l_obj.ByteSize, int(TESTING_SERIAL_BYTE_SIZE)) self.assertEqual(l_obj.Parity, TESTING_SERIAL_PARITY) self.assertEqual(str(l_obj.RtsCts), TESTING_SERIAL_RTS_CTS) self.assertEqual(l_obj.StopBits, float(TESTING_SERIAL_STOP_BITS)) self.assertEqual(l_obj.Timeout, float(TESTING_SERIAL_TIMEOUT)) self.assertEqual(l_obj.XonXoff, TESTING_SERIAL_XON_XOFF == 'True') self.assertEqual(l_obj.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0)) self.assertEqual(l_obj.DevCat, conversions.dotted_hex2int(TESTING_INSTEON_DEVCAT_0)) self.assertEqual(l_obj.GroupList, TESTING_INSTEON_GROUP_LIST_0) self.assertEqual(l_obj.GroupNumber, int(TESTING_INSTEON_GROUP_NUM_0))
def test_06_OneController(self): """ Read in the xml file and fill in the lights """ l_obj = Utility._read_one_controller_xml(self.m_pyhouse_obj, self.m_xml.controller, self.m_version) print(PrettyFormatAny.form(l_obj, 'OneController', 100)) self.assertEqual(l_obj.Name, TESTING_CONTROLLER_NAME_0) self.assertEqual(l_obj.Active, (TESTING_CONTROLLER_ACTIVE_0 == 'True')) self.assertEqual(l_obj.LightingType, TESTING_CONTROLLER_TYPE_0) self.assertEqual(l_obj.Comment, TESTING_DEVICE_COMMENT) self.assertEqual(l_obj.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON) self.assertEqual(l_obj.DeviceType, int(TESTING_DEVICE_TYPE)) self.assertEqual(l_obj.DeviceSubType, int(TESTING_DEVICE_SUBTYPE)) self.assertEqual(l_obj.RoomName, TESTING_DEVICE_ROOM_NAME) self.assertEqual(l_obj.InterfaceType, TESTING_INTERFACE_TYPE_SERIAL) self.assertEqual(l_obj.Port, TESTING_INTERFACE_PORT_SERIAL) self.assertEqual(l_obj.BaudRate, int(TESTING_SERIAL_BAUD_RATE)) self.assertEqual(l_obj.ByteSize, int(TESTING_SERIAL_BYTE_SIZE)) self.assertEqual(l_obj.Parity, TESTING_SERIAL_PARITY) self.assertEqual(l_obj.RtsCts, TESTING_SERIAL_RTS_CTS == 'True') self.assertEqual(l_obj.StopBits, float(TESTING_SERIAL_STOP_BITS)) self.assertEqual(l_obj.Timeout, float(TESTING_SERIAL_TIMEOUT)) self.assertEqual(l_obj.XonXoff, TESTING_SERIAL_XON_XOFF == 'True') self.assertEqual(l_obj.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0)) self.assertEqual(l_obj.DevCat, conversions.dotted_hex2int(TESTING_INSTEON_DEVCAT_0)) self.assertEqual(l_obj.GroupList, TESTING_INSTEON_GROUP_LIST_0) self.assertEqual(l_obj.GroupNumber, int(TESTING_INSTEON_GROUP_NUM_0))
def test_04_OneXml(self): """ Write out the XML file for the location section """ l_controllers = self.m_api.read_all_controllers_xml(self.m_pyhouse_obj, self.m_xml.controller_sect, self.m_version) l_xml = Utility._write_one_controller_xml(self.m_pyhouse_obj, l_controllers[0]) # print(PrettyFormatAny.form(l_xml, 'AllControllers', 100)) self.assertEqual(l_xml.find('Address').text, TESTING_INSTEON_ADDRESS_0) self.assertEqual(l_xml.find('DevCat').text, TESTING_INSTEON_DEVCAT_0) self.assertEqual(l_xml.find('GroupList').text, TESTING_INSTEON_GROUP_LIST_0) self.assertEqual(l_xml.find('GroupNumber').text, TESTING_INSTEON_GROUP_NUM_0)
def test_04_OneXml(self): """ Write out the XML file for the location section """ l_controllers = self.m_api.read_all_controllers_xml(self.m_pyhouse_obj) l_xml = Utility._write_one_controller_xml(self.m_pyhouse_obj, l_controllers[0]) # print(PrettyFormatAny.form(l_xml, 'AllControllers', 100)) self.assertEqual(l_xml.find('InsteonAddress').text, TESTING_INSTEON_ADDRESS_0) self.assertEqual(l_xml.find('DevCat').text, TESTING_INSTEON_DEVCAT_0) self.assertEqual(l_xml.find('GroupList').text, TESTING_INSTEON_GROUP_LIST_0) self.assertEqual(l_xml.find('GroupNumber').text, TESTING_INSTEON_GROUP_NUM_0)
def test_01_BaseDevice(self): """Read Base Device """ l_obj = Utility._read_base_device(self.m_xml.controller, self.m_version) self.assertEqual(l_obj.Name, TESTING_CONTROLLER_NAME_0) self.assertEqual(l_obj.Active, (TESTING_CONTROLLER_ACTIVE_0 == 'True')) self.assertEqual(l_obj.LightingType, TESTING_CONTROLLER_TYPE_0) self.assertEqual(l_obj.Comment, TESTING_DEVICE_COMMENT) self.assertEqual(l_obj.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON) self.assertEqual(l_obj.DeviceType, int(TESTING_DEVICE_TYPE)) self.assertEqual(l_obj.DeviceSubType, int(TESTING_DEVICE_SUBTYPE)) self.assertEqual(l_obj.RoomName, TESTING_DEVICE_ROOM_NAME)
def test_01_BaseDevice(self): """Read Base Device """ l_xml = self.m_xml.controller l_obj = Utility._read_base_device(self.m_pyhouse_obj, l_xml) # print(PrettyFormatAny.form(l_obj, 'AllControllers')) self.assertEqual(l_obj.Name, TESTING_CONTROLLER_NAME_0) self.assertEqual(str(l_obj.Active), TESTING_CONTROLLER_ACTIVE_0) self.assertEqual(l_obj.LightingType, TESTING_CONTROLLER_TYPE_0) self.assertEqual(l_obj.Comment, TESTING_DEVICE_COMMENT) self.assertEqual(l_obj.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON) self.assertEqual(str(l_obj.DeviceType), TESTING_DEVICE_TYPE) self.assertEqual(str(l_obj.DeviceSubType), TESTING_DEVICE_SUBTYPE) self.assertEqual(l_obj.RoomName, TESTING_DEVICE_ROOM_NAME)
def test_01_Base(self): """ Write out the XML file for the Base controller """ l_controllers = self.m_api.read_all_controllers_xml(self.m_pyhouse_obj, self.m_xml.controller_sect, self.m_version) l_xml = Utility._write_base_device(l_controllers[0]) # print(PrettyFormatAny.form(l_xml, 'Base')) self.assertEqual(l_xml.attrib['Name'], TESTING_CONTROLLER_NAME_0) self.assertEqual(l_xml.attrib['Key'], TESTING_CONTROLLER_KEY_0) self.assertEqual(bool(l_xml.attrib['Active']), TESTING_CONTROLLER_ACTIVE_0 == 'True') self.assertEqual(l_xml.find('Comment').text, TESTING_DEVICE_COMMENT) self.assertEqual(l_xml.find('DeviceFamily').text, TESTING_DEVICE_FAMILY_INSTEON) self.assertEqual(l_xml.find('DeviceType').text, TESTING_DEVICE_TYPE) self.assertEqual(l_xml.find('DeviceSubType').text, TESTING_DEVICE_SUBTYPE) self.assertEqual(l_xml.find('RoomName').text, TESTING_DEVICE_ROOM_NAME)
def test_04_Family(self): """Read controller family """ l_xml = self.m_xml.controller l_obj = Utility._read_base_device(self.m_pyhouse_obj, l_xml) Utility._read_controller_data(self.m_pyhouse_obj, l_obj, l_xml) Utility._read_interface_data(self.m_pyhouse_obj, l_obj, l_xml) Utility._read_family_data(self.m_pyhouse_obj, l_obj, l_xml) self.assertEqual(l_obj.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0)) self.assertEqual(l_obj.DevCat, conversions.dotted_hex2int(TESTING_INSTEON_DEVCAT_0)) self.assertEqual(l_obj.ProductKey, conversions.dotted_hex2int(TESTING_INSTEON_PRODUCT_KEY_0)) self.assertEqual(l_obj.GroupList, TESTING_INSTEON_GROUP_LIST_0) self.assertEqual(l_obj.GroupNumber, int(TESTING_INSTEON_GROUP_NUM_0))
def test_04_Family(self): """ Write out the XML file for the location section """ l_controllers = self.m_api.read_all_controllers_xml(self.m_pyhouse_obj) l_xml = Utility._write_base_device(l_controllers[0]) Utility._write_controller_data(l_controllers[0], l_xml) Utility._write_interface_data(l_controllers[0], l_xml) Utility._write_family_data(self.m_pyhouse_obj, l_controllers[0], l_xml) print(PrettyFormatAny.form(l_xml, 'w/ Family', 100)) self.assertEqual(l_xml.find('InsteonAddress').text, TESTING_INSTEON_ADDRESS_0) self.assertEqual(l_xml.find('DevCat').text, TESTING_INSTEON_DEVCAT_0) self.assertEqual(l_xml.find('GroupList').text, TESTING_INSTEON_GROUP_LIST_0) self.assertEqual(l_xml.find('GroupNumber').text, TESTING_INSTEON_GROUP_NUM_0)
def test_04_Family(self): """Read controller family """ l_obj = Utility._read_base_device(self.m_xml.controller, self.m_version) Utility._read_controller_data(l_obj, self.m_xml.controller, self.m_version) Utility._read_interface_data(l_obj, self.m_xml.controller, self.m_version) Utility._read_family_data(self.m_pyhouse_obj, l_obj, self.m_xml.controller, self.m_version) self.assertEqual(l_obj.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0)) self.assertEqual(l_obj.DevCat, conversions.dotted_hex2int(TESTING_INSTEON_DEVCAT_0)) self.assertEqual(l_obj.ProductKey, conversions.dotted_hex2int(TESTING_INSTEON_PRODUCT_KEY_0)) self.assertEqual(l_obj.GroupList, TESTING_INSTEON_GROUP_LIST_0) self.assertEqual(l_obj.GroupNumber, int(TESTING_INSTEON_GROUP_NUM_0)) self.assertEqual(l_obj.Version, int(TESTING_INSTEON_VERSION))
def test_01_Base(self): """ Write out the XML file for the Base controller """ l_controllers = self.m_api.read_all_controllers_xml(self.m_pyhouse_obj) l_xml = Utility._write_base_device(l_controllers[0]) # print(PrettyFormatAny.form(l_xml, 'Base')) self.assertEqual(l_xml.attrib['Name'], TESTING_CONTROLLER_NAME_0) self.assertEqual(l_xml.attrib['Key'], TESTING_CONTROLLER_KEY_0) self.assertEqual(bool(l_xml.attrib['Active']), TESTING_CONTROLLER_ACTIVE_0 == 'True') self.assertEqual(l_xml.find('UUID').text, TESTING_CONTROLLER_UUID_0) self.assertEqual(l_xml.find('Comment').text, TESTING_DEVICE_COMMENT) self.assertEqual(l_xml.find('DeviceFamily').text, TESTING_DEVICE_FAMILY_INSTEON) self.assertEqual(l_xml.find('DeviceType').text, TESTING_DEVICE_TYPE) self.assertEqual(l_xml.find('DeviceSubType').text, TESTING_DEVICE_SUBTYPE) self.assertEqual(l_xml.find('RoomName').text, TESTING_DEVICE_ROOM_NAME) self.assertEqual(l_xml.find('RoomUUID').text, TESTING_DEVICE_ROOM_UUID)