Exemplo n.º 1
0
 def None_Name_Property(self):
     address = AbstractAddress(line1='800 Federal St',
                               line2='',
                               line4='Andover',
                               state='MA',
                               postcode='01810')
     self.assertRaises(ValueError,
                       EasyPostAddressFormatter,
                       address=address)
Exemplo n.º 2
0
 def None_PostCode_Property(self):
     address = AbstractAddress(first_name='Bob',
                               last_name='Doel',
                               line1='800 Federal St',
                               line2='',
                               line4='Andover',
                               state='MA')
     self.assertRaises(ValueError,
                       EasyPostAddressFormatter,
                       address=address)
Exemplo n.º 3
0
 def None_City_Property(self):
     address = AbstractAddress(first_name='Bob',
                               last_name='Doel',
                               line1='800 Federal St',
                               line2='',
                               state='MA',
                               postcode='01810')
     self.assertRaises(ValueError,
                       EasyPostAddressFormatter,
                       address=address)
Exemplo n.º 4
0
 def None_Line2_Property(self):
     address = AbstractAddress(first_name='Bob',
                               last_name='Doel',
                               line1='123 elm',
                               line4='Andover',
                               state='MA',
                               postcode='01810')
     easyPostAdddress = EasyPostAddressFormatter(address)
     self.assertIn('street2', easyPostAdddress)
     self.assertEqual(easyPostAdddress['street2'], address.line2)
Exemplo n.º 5
0
 def None_Line1_Property(self):
     address = AbstractAddress(first_name='Bob',
                               last_name='Doel',
                               line2='',
                               line4='Andover',
                               state='MA',
                               postcode='01810')
     self.assertRaises(ValueError,
                       EasyPostAddressFormatter,
                       address=address)
Exemplo n.º 6
0
 def Whitespace_State_Property(self):
     address = AbstractAddress(first_name='Bob',
                               last_name='Doel',
                               line1='800 Federal St',
                               line2='',
                               line4='Andover',
                               state=' ',
                               postcode='01810')
     self.assertRaises(ValueError,
                       EasyPostAddressFormatter,
                       address=address)
Exemplo n.º 7
0
    def Valid_Address(self):
        address = AbstractAddress(first_name='Bob',
                                  last_name='Doel',
                                  line1='800 Federal St',
                                  line2='',
                                  line4='Andover',
                                  state='MA',
                                  postcode='01810')

        easyPostAdddress = EasyPostAddressFormatter(address)
        self.assertIn('name', easyPostAdddress)
        self.assertEqual(easyPostAdddress['name'], address.name)
        self.assertIn('street1', easyPostAdddress)
        self.assertEqual(easyPostAdddress['street1'], address.line1)
        self.assertIn('street2', easyPostAdddress)
        self.assertEqual(easyPostAdddress['street2'], address.line2)
        self.assertIn('city', easyPostAdddress)
        self.assertEqual(easyPostAdddress['city'], address.city)
        self.assertIn('state', easyPostAdddress)
        self.assertEqual(easyPostAdddress['state'], address.state)
        self.assertIn('zip', easyPostAdddress)
        self.assertEqual(easyPostAdddress['zip'], address.postcode)