Breaks cart batching tests into multiple tests
This commit is contained in:
		
							parent
							
								
									94ceaa3bb1
								
							
						
					
					
						commit
						ad2de6e9d4
					
				
					 1 changed files with 12 additions and 6 deletions
				
			
		|  | @ -362,24 +362,29 @@ class BasicCartTests(RegistrationCartTestCase): | |||
|     def test_available_products_respects_product_limits(self): | ||||
|         self.__available_products_test(self.PROD_4, 6) | ||||
| 
 | ||||
|     def test_cart_controller_batching(self): | ||||
|     def test_cart_controller_for_user_is_memoised(self): | ||||
|         # - that for_user is memoised | ||||
|         with BatchController.batch(self.USER_1): | ||||
|             cart = TestingCartController.for_user(self.USER_1) | ||||
|             cart_2 = TestingCartController.for_user(self.USER_1) | ||||
|         self.assertIs(cart, cart_2) | ||||
| 
 | ||||
|         # - that the revision only increments on modifications | ||||
|     def test_cart_revision_does_not_increment_if_not_modified(self): | ||||
|         cart = TestingCartController.for_user(self.USER_1) | ||||
|         rev_0 = cart.cart.revision | ||||
| 
 | ||||
|         with BatchController.batch(self.USER_1): | ||||
|             # Memoise the cart | ||||
|             same_cart = TestingCartController.for_user(self.USER_1) | ||||
|             # Do nothing on exit | ||||
|          | ||||
|         rev_1 = self.reget(cart.cart).revision | ||||
|         self.assertEqual(rev_0, rev_1) | ||||
| 
 | ||||
|         # - that the revision only increments on the outside of a batch | ||||
|     def test_cart_revision_only_increments_at_end_of_batches(self): | ||||
|         cart = TestingCartController.for_user(self.USER_1) | ||||
|         rev_0 = cart.cart.revision | ||||
| 
 | ||||
|         with BatchController.batch(self.USER_1): | ||||
|             # Memoise the cart | ||||
|             same_cart = TestingCartController.for_user(self.USER_1) | ||||
|  | @ -387,17 +392,18 @@ class BasicCartTests(RegistrationCartTestCase): | |||
|             rev_1 = self.reget(same_cart.cart).revision | ||||
| 
 | ||||
|         rev_2 = self.reget(cart.cart).revision | ||||
|         cart.set_quantity(self.PROD_1, 0) | ||||
| 
 | ||||
|         self.assertEqual(rev_0, rev_1) | ||||
|         self.assertNotEqual(rev_0, rev_2) | ||||
| 
 | ||||
|         # - that discounts are only calculated on modifications o/s batch | ||||
|     def test_cart_discounts_only_calculated_at_end_of_batches(self): | ||||
|         def count_discounts(cart): | ||||
|             return cart.cart.discountitem_set.count() | ||||
| 
 | ||||
|         count_0 = count_discounts(cart.cart) | ||||
|         cart = TestingCartController.for_user(self.USER_1) | ||||
|         self.make_discount_ceiling("FLOOZLE") | ||||
|         count_0 = count_discounts(cart.cart) | ||||
| 
 | ||||
|         with BatchController.batch(self.USER_1): | ||||
|             # Memoise the cart | ||||
|             same_cart = TestingCartController.for_user(self.USER_1) | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Christopher Neugebauer
						Christopher Neugebauer