示例#1
0
文件: tests.py 项目: D0han/saleor
 def test_select_method(self):
     '''
     Test the BaseShippingStep managment form when method is set to 'select'
     and user isn't authenticated.
     '''
     self.request.POST = SELECT_ADDRESS_POST
     step = BaseShippingStep(self.checkout, self.request, self.address)
     self.assertFalse(step.forms_are_valid(), 'Forms should not validate.')
示例#2
0
 def test_select_method(self):
     '''
     Test the BaseShippingStep managment form when method is set to 'select'
     and user isn't authenticated.
     '''
     self.request.POST = SELECT_ADDRESS_POST
     step = BaseShippingStep(self.checkout, self.request, self.address)
     self.assertFalse(step.forms_are_valid(), 'Forms should not validate.')
示例#3
0
文件: tests.py 项目: D0han/saleor
 def test_new_method(self):
     '''
     Test the BaseShippingStep managment form when method is set to 'new'
     and user isn't authenticated.
     '''
     self.request.POST = NEW_ADDRESS_POST
     step = BaseShippingStep(self.checkout, self.request, self.address)
     self.assertTrue(step.forms_are_valid(), 'Forms don\'t validate.')
     self.assertEqual(step.address.first_name, 'Test')
示例#4
0
 def test_new_method(self):
     '''
     Test the BaseShippingStep managment form when method is set to 'new'
     and user isn't authenticated.
     '''
     self.request.POST = NEW_ADDRESS_POST
     step = BaseShippingStep(self.checkout, self.request, self.address)
     self.assertTrue(step.forms_are_valid(), 'Forms don\'t validate.')
     self.assertEqual(step.address.first_name, 'Test')
示例#5
0
文件: tests.py 项目: D0han/saleor
 def test_select_with_user_method(self):
     '''
     Test the BaseShippingStep managment form when method is set to 'select'
     and user is authenticated.
     '''
     user = self.request.user
     self.request.POST = SELECT_ADDRESS_POST
     user.is_authenticated.return_value = True
     user.address_book.all.__iter__.return_value = [self.address]
     step = BaseShippingStep(self.checkout, self.request, self.address)
     self.assertTrue(step.forms_are_valid(), 'Forms don\'t validate.')
示例#6
0
 def test_select_with_user_method(self):
     '''
     Test the BaseShippingStep managment form when method is set to 'select'
     and user is authenticated.
     '''
     user = self.request.user
     self.request.POST = SELECT_ADDRESS_POST
     user.is_authenticated.return_value = True
     user.address_book.all.__iter__.return_value = [self.address]
     step = BaseShippingStep(self.checkout, self.request, self.address)
     self.assertTrue(step.forms_are_valid(), 'Forms don\'t validate.')