コード例 #1
0
 def test_delivery_is_billing_are_different(self):
     """if the delivery_is_button is checked then the delivery address is
     populated from the billing"""
     data = {
         'name': 'test testerson',
         'email': '*****@*****.**',
         'delivery_is_billing': '',
         'billing_address_1': '1 Somewhere',
         'billing_address_2': '2 Somewhere',
         'billing_town': 'hasdsad',
         'billing_city': 'Yeah Yeah',
         'billing_postcode': '1SM W33',
         'billing_country': 'GB',
         'delivery_address_1': 'X 1 Somewhere',
         'delivery_address_2': 'X 2 Somewhere',
         'delivery_town': 'X hasdsad',
         'delivery_city': 'X Yeah Yeah',
         'delivery_postcode': 'X 1SM W33',
         'delivery_country': 'GB'
     }
     form = CustomerForm(data)
     self.assertTrue(form.is_valid())
     customer = form.save()
     # all fields match up
     self.failIfEqual(customer.delivery_address_1, data['billing_address_1'])
     self.failIfEqual(customer.delivery_address_2, data['billing_address_2'])
     self.failIfEqual(customer.delivery_city, data['billing_city'])
     self.failIfEqual(customer.delivery_town, data['billing_town'])
     self.failIfEqual(customer.delivery_postcode, data['billing_postcode'])
コード例 #2
0
 def test_delivery_is_billing_not_checked(self):
     """if the delivery_is_button is not checked then the delivery address is
     required"""
     data = {
         'name': 'test testerson',
         'email': '*****@*****.**',
         'delivery_is_billing': 'on',
     }
     form = CustomerForm(data)
     self.assertFalse(form.is_valid())