예제 #1
0
 def test_01_OneButton(self):
     """ Write out the XML file for the button section
     """
     l_button = buttonsXML()._read_one_button_xml(self.m_pyhouse_obj,
                                                  self.m_xml.button)
     self.m_pyhouse_obj.House.Lighting.Buttons = l_button
     l_xml = buttonsXML()._write_one_button_xml(self.m_pyhouse_obj,
                                                l_button)
     # print(PrettyFormatAny.form(l_xml, 'B2-01-A - Button'))
     self.assertEqual(l_xml.attrib['Name'], TESTING_LIGHTING_BUTTON_NAME_0)
     self.assertEqual(l_xml.attrib['Key'], TESTING_LIGHTING_BUTTON_KEY_0)
     self.assertEqual(str(l_xml.attrib['Active']),
                      TESTING_LIGHTING_BUTTON_ACTIVE_0)
     self.assertEqual(
         l_xml.find('UUID').text, TESTING_LIGHTING_BUTTON_UUID_0)
     self.assertEqual(
         l_xml.find('Comment').text, TESTING_LIGHTING_BUTTON_COMMENT_0)
     self.assertEqual(
         l_xml.find('DeviceFamily').text, TESTING_LIGHTING_BUTTON_FAMILY_0)
     self.assertEqual(
         l_xml.find('DeviceType').text,
         TESTING_LIGHTING_BUTTON_DEVICE_TYPE_0)
     self.assertEqual(
         l_xml.find('DeviceSubType').text,
         TESTING_LIGHTING_BUTTON_DEVICE_SUBTYPE_0)
     self.assertEqual(
         l_xml.find('RoomName').text, TESTING_LIGHTING_BUTTON_ROOM_NAME_0)
     self.assertEqual(
         l_xml.find('RoomUUID').text, TESTING_LIGHTING_BUTTON_ROOM_UUID_0)
예제 #2
0
 def test_06_CreateJson(self):
     """ Create a JSON object for Buttons.
     """
     l_button = buttonsXML().read_all_buttons_xml(self.m_pyhouse_obj)
     self.m_pyhouse_obj.House.Lighting.Buttons = l_button
     # print('Buttons: {}'.format(l_button))
     # print('Button 0: {}'.format(vars(l_button[0])))
     l_json = json_tools.encode_json(l_button)
예제 #3
0
 def test_02_ReadOneButtonXml(self):
     """ Read in the xml file and fill in the lights
     """
     l_button = buttonsXML()._read_one_button_xml(self.m_pyhouse_obj,
                                                  self.m_xml.button)
     self.assertEqual(l_button.Name, TESTING_LIGHTING_BUTTON_NAME_0)
     self.assertEqual(l_button.Active, True)
     self.assertEqual(l_button.Key, 0, 'Bad key')
     self.assertEqual(l_button.Name, TESTING_LIGHTING_BUTTON_NAME_0)
     self.assertEqual(l_button.DeviceFamily,
                      TESTING_LIGHTING_BUTTON_FAMILY_0)
     self.assertEqual(
         l_button.InsteonAddress,
         convert.dotted_hex2int(TESTING_LIGHTING_BUTTON_INSTEON_ADDRESS_0))
예제 #4
0
 def test_02_AllButtons(self):
     """ Write out the XML file for the Buttons section
     """
     l_buttons = buttonsXML().read_all_buttons_xml(self.m_pyhouse_obj)
     self.m_pyhouse_obj.House.Lighting.Buttons = l_buttons
     l_xml = buttonsXML().write_all_buttons_xml(self.m_pyhouse_obj)
예제 #5
0
 def test_03_ReadAllButtonsXml(self):
     l_buttons = buttonsXML().read_all_buttons_xml(self.m_pyhouse_obj)
     # print(PrettyFormatAny.form(l_buttons, 'B1-03-B - Button'))
     self.assertEqual(len(l_buttons), 2)