Exemplo n.º 1
0
 def test_02_Obj(self):
     """ Be sure that the XML contains the right stuff.
     """
     l_obj = LocationData()
     l_obj.Street = '123 Test Street'
     l_obj.City = 'Beverly Hills'
     l_obj.State = 'Confusion'
     _l_json = json_tools.encode_json(l_obj)
Exemplo n.º 2
0
 def test_02_Obj(self):
     """ Be sure that the XML contains the right stuff.
     """
     l_obj = LocationData()
     l_obj.Street = '123 Test Street'
     l_obj.City = 'Beverly Hills'
     l_obj.State = 'Confusion'
     l_json = json_tools.encode_json(l_obj)
Exemplo n.º 3
0
 def test_01_StuffAttrs(self):
     l_objA = CoreLightingData()
     l_objA.Name = 'Test 1A'
     # print(PrettyFormatAny.form(l_objA, 'Obj A'))
     l_objB = LocationData()
     l_objB.Street = 'Some road'
     # print(PrettyFormatAny.form(l_objB, 'Obj B', 120))
     #
     stuff_new_attrs(l_objA, l_objB)
     # print(PrettyFormatAny.form(l_objA, 'Result B stuffed into A', 120))
     self.assertEqual(l_objA.Street, 'Some road')
Exemplo n.º 4
0
 def test_01_StuffAttrs(self):
     l_objA = CoreLightingData()
     l_objA.Name = 'Test 1A'
     # print(PrettyFormatAny.form(l_objA, 'Obj A'))
     l_objB = LocationData()
     l_objB.Street = 'Some road'
     # print(PrettyFormatAny.form(l_objB, 'Obj B', 120))
     #
     stuff_new_attrs(l_objA, l_objB)
     # print(PrettyFormatAny.form(l_objA, 'Result B stuffed into A', 120))
     self.assertEqual(l_objA.Street, 'Some road')
Exemplo n.º 5
0
 def _build_house(p_pyhouse_obj):
     l_ret = HouseInformation()
     l_ret.Name = 'Test House'
     l_ret.Location = LocationData()
     #  Added family build 2015-08-19
     l_ret.FamilyData = familyUtil._init_component_apis(p_pyhouse_obj)
     l_ret.Lighting = LightingData()
     return l_ret
Exemplo n.º 6
0
 def load_earth(p_pyhouse_obj):
     l_loc = LocationData()
     l_loc.Region = T_REGION
     l_loc.Latitude = T_LATITUDE
     l_loc.Longitude = T_LONGITUDE
     l_loc.TimeZoneName = T_TIMEZONE_NAME
     l_loc.Elevation = T_ELEVATION
     p_pyhouse_obj.House.Location = l_loc
     p_pyhouse_obj.House.Name = T_NAME
     return p_pyhouse_obj
Exemplo n.º 7
0
 def load_earth(p_pyhouse_obj):
     l_loc = LocationData()
     l_loc.Region = TESTING_LOCATION_REGION
     l_loc.Latitude = float(TESTING_LOCATION_LATITUDE)
     l_loc.Longitude = float(TESTING_LOCATION_LONGITUDE)
     l_loc.TimeZoneName = TESTING_LOCATION_TIME_ZONE_NAME
     l_loc.Elevation = float(TESTING_LOCATION_ELEVATION)
     p_pyhouse_obj.House.Location = l_loc
     p_pyhouse_obj.House.Name = TESTING_HOUSE_NAME
     return p_pyhouse_obj
Exemplo n.º 8
0
 def load_earth(p_pyhouse_obj):
     l_loc = LocationData()
     l_loc.Region = T_REGION
     l_loc.Latitude = T_LATITUDE
     l_loc.Longitude = T_LONGITUDE
     l_loc.TimeZoneName = T_TIMEZONE_NAME
     l_loc.Elevation = T_ELEVATION
     p_pyhouse_obj.House.Location = l_loc
     p_pyhouse_obj.House.Name = T_NAME
     return p_pyhouse_obj
Exemplo n.º 9
0
 def _pyHouses(self):
     SetupMixin.setUp(self, ET.fromstring(XML_LONG))
     self.m_house_obj = LocationData()
     self.m_api = location.Xml()
Exemplo n.º 10
0
 def read_location_xml(p_pyhouse_obj):
     """
     @param p_house_xml: is the config file xml for a house.
     """
     l_obj = LocationData()
     l_obj.RiseSet = RiseSetData()
     p_pyhouse_obj.House.Location = l_obj
     try:
         l_xml = p_pyhouse_obj.Xml.XmlRoot.find('HouseDivision')
         if l_xml is None:
             return l_obj
         l_xml = l_xml.find('LocationSection')
         if l_xml is None:
             return l_obj
         l_obj.Street = PutGetXML.get_text_from_xml(l_xml, 'Street', 'Main')
         l_obj.City = PutGetXML.get_text_from_xml(l_xml, 'City', 'Gotham')
         l_obj.State = PutGetXML.get_text_from_xml(l_xml, 'State', 'Confusion')
         l_obj.ZipCode = PutGetXML.get_text_from_xml(l_xml, 'ZipCode', '99999')
         l_obj.Region = PutGetXML.get_text_from_xml(l_xml, 'Region', 'America')
         l_obj.Phone = PutGetXML.get_text_from_xml(l_xml, 'Phone', '800-555-1212')
         l_obj.Latitude = PutGetXML.get_float_from_xml(l_xml, 'Latitude', 40.0)
         l_obj.Longitude = PutGetXML.get_float_from_xml(l_xml, 'Longitude', 100.0)
         l_obj.Elevation = PutGetXML.get_float_from_xml(l_xml, 'Elevation', 10.0)
         l_obj.TimeZoneName = PutGetXML.get_text_from_xml(l_xml, 'TimeZoneName', 'America/New_York')
     except AttributeError as e_err:
         LOG.error('ERROR getting location Data - {}'.format(e_err))
     p_pyhouse_obj.House.Location = l_obj
     LOG.info('Loaded location information.')
     return l_obj
Exemplo n.º 11
0
 def read_location_xml(p_pyhouse_obj):
     """
     @param p_house_xml: is the config file xml for a house.
     """
     l_obj = LocationData()
     l_obj.RiseSet = RiseSetData()
     p_pyhouse_obj.House.Location = l_obj
     try:
         l_xml = p_pyhouse_obj.Xml.XmlRoot.find('HouseDivision')
         if l_xml is None:
             return l_obj
         l_xml = l_xml.find('LocationSection')
         if l_xml is None:
             return l_obj
         l_obj.Street = PutGetXML.get_text_from_xml(l_xml, 'Street')
         l_obj.City = PutGetXML.get_text_from_xml(l_xml, 'City')
         l_obj.State = PutGetXML.get_text_from_xml(l_xml, 'State')
         l_obj.ZipCode = PutGetXML.get_text_from_xml(l_xml, 'ZipCode', '99999')
         l_obj.Region = PutGetXML.get_text_from_xml(l_xml, 'Region', 'America')
         l_obj.Phone = PutGetXML.get_text_from_xml(l_xml, 'Phone')
         l_obj.Latitude = PutGetXML.get_float_from_xml(l_xml, 'Latitude')
         l_obj.Longitude = PutGetXML.get_float_from_xml(l_xml, 'Longitude')
         l_obj.Elevation = PutGetXML.get_float_from_xml(l_xml, 'Elevation', 10)
         l_obj.TimeZoneName = PutGetXML.get_text_from_xml(l_xml, 'TimeZoneName', 'America/New_York')
     except AttributeError as e_err:
         LOG.error('ERROR getting location Data - {}'.format(e_err))
     p_pyhouse_obj.House.Location = l_obj
     LOG.info('Loaded location information.')
     return l_obj