Example #1
0
    def test_get_postal_number(self):
        person = self.create_person()
        location = self.create_city_location()
        address = Address(person=person, city_location=location,
                          postal_code=u'12345-678', store=self.store)

        self.assertEquals(address.get_postal_code_number(), 12345678)
        address.postal_code = u'13560-xxx'
        self.assertEquals(address.get_postal_code_number(), 13560)
        address.postal_code = None
        self.assertEquals(address.get_postal_code_number(), 0)
Example #2
0
    def test_get_postal_number(self):
        person = self.create_person()
        location = self.create_city_location()
        address = Address(person=person, city_location=location,
                          postal_code=u'12345-678', store=self.store)

        self.assertEquals(address.get_postal_code_number(), 12345678)
        address.postal_code = u'13560-xxx'
        self.assertEquals(address.get_postal_code_number(), 13560)
        address.postal_code = None
        self.assertEquals(address.get_postal_code_number(), 0)
Example #3
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))
Example #4
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))