Exemple #1
0
 def testGetDetailsString(self):
     person = self.create_person()
     city = u'Stoqlandia'
     state = u'SP'
     country = u'Brazil'
     postal_code = u'12345-678'
     location = CityLocation(city=city, state=state, country=country,
                             store=self.store)
     address = Address(person=person, city_location=location,
                       postal_code=postal_code, store=self.store)
     string = address.get_details_string()
     self.assertEquals(string, u'%s - %s - %s' % (postal_code,
                                                  city, state))
     location.city = u''
     string = address.get_details_string()
     self.assertEquals(string, u'%s' % postal_code)
     location.state = u''
     string = address.get_details_string()
     self.assertEquals(string, u'%s' % postal_code)
     address.postal_code = u''
     string = address.get_details_string()
     self.assertEquals(string, u'')
     location.city = city
     location.state = state
     string = address.get_details_string()
     self.assertEquals(string, u'%s - %s' % (city, state))
Exemple #2
0
 def testGetDetailsString(self):
     person = self.create_person()
     city = u'Stoqlandia'
     state = u'SP'
     country = u'Brazil'
     postal_code = u'12345-678'
     location = CityLocation(city=city,
                             state=state,
                             country=country,
                             store=self.store)
     address = Address(person=person,
                       city_location=location,
                       postal_code=postal_code,
                       store=self.store)
     string = address.get_details_string()
     self.assertEquals(string, u'%s - %s - %s' % (postal_code, city, state))
     location.city = u''
     string = address.get_details_string()
     self.assertEquals(string, u'%s' % postal_code)
     location.state = u''
     string = address.get_details_string()
     self.assertEquals(string, u'%s' % postal_code)
     address.postal_code = u''
     string = address.get_details_string()
     self.assertEquals(string, u'')
     location.city = city
     location.state = state
     string = address.get_details_string()
     self.assertEquals(string, u'%s - %s' % (city, state))