Changeset - 2f77f5bb23ee
[Not reviewed]
0 6 0
Christopher Neugebauer - 8 years ago 2016-04-06 07:24:25
chrisjrn@gmail.com
Replaces .active = False; .save() pattern in tests with a test controller method
6 files changed with 55 insertions and 51 deletions:
0 comments (0 inline, 0 general)
registrasion/tests/cart_controller_helper.py
Show inline comments
...
 
@@ -26 +26,5 @@ class TestingCartController(CartController):
 
        self.set_quantity(product, old_quantity + quantity)
 

	
 
    def next_cart(self):
 
        self.cart.active = False
 
        self.cart.save()
registrasion/tests/test_cart.py
Show inline comments
...
 
@@ -76,8 +76,8 @@ class RegistrationCartTestCase(SetTimeMixin, TestCase):
 
        current_cart = TestingCartController.for_user(cls.USER_1)
 
        current_cart.cart.active = False
 
        current_cart.cart.save()
 

	
 
        current_cart.next_cart()
 

	
 
        current_cart = TestingCartController.for_user(cls.USER_2)
 
        current_cart.cart.active = False
 
        current_cart.cart.save()
 

	
 
        current_cart.next_cart()
 

	
...
 
@@ -144,4 +144,4 @@ class BasicCartTests(RegistrationCartTestCase):
 

	
 
        current_cart.cart.active = False
 
        current_cart.cart.save()
 

	
 
        current_cart.next_cart()
 

	
...
 
@@ -216,4 +216,4 @@ class BasicCartTests(RegistrationCartTestCase):
 

	
 
        current_cart.cart.active = False
 
        current_cart.cart.save()
 

	
 
        current_cart.next_cart()
 

	
...
 
@@ -274,4 +274,4 @@ class BasicCartTests(RegistrationCartTestCase):
 

	
 
        current_cart.cart.active = False
 
        current_cart.cart.save()
 

	
 
        current_cart.next_cart()
 

	
...
 
@@ -300,4 +300,4 @@ class BasicCartTests(RegistrationCartTestCase):
 
        # The limits should extend across carts...
 
        current_cart.cart.active = False
 
        current_cart.cart.save()
 

	
 
        current_cart.next_cart()
 

	
...
 
@@ -327,4 +327,4 @@ class BasicCartTests(RegistrationCartTestCase):
 

	
 
        current_cart.cart.active = False
 
        current_cart.cart.save()
 

	
 
        current_cart.next_cart()
 

	
registrasion/tests/test_ceilings.py
Show inline comments
...
 
@@ -93,4 +93,4 @@ class CeilingsTestCases(RegistrationCartTestCase):
 
        # User 2 pays for their cart
 
        second_cart.cart.active = False
 
        second_cart.cart.save()
 

	
 
        second_cart.next_cart()
 

	
...
 
@@ -130,4 +130,4 @@ class CeilingsTestCases(RegistrationCartTestCase):
 
        # Paid cart outside the reservation window
 
        second_cart.cart.active = False
 
        second_cart.cart.save()
 

	
 
        second_cart.next_cart()
 
        self.add_timedelta(self.RESERVATION + datetime.timedelta(seconds=1))
...
 
@@ -142,4 +142,4 @@ class CeilingsTestCases(RegistrationCartTestCase):
 

	
 
        first_cart.cart.active = False
 
        first_cart.cart.save()
 

	
 
        first_cart.next_cart()
 

	
...
 
@@ -150,3 +150,3 @@ class CeilingsTestCases(RegistrationCartTestCase):
 
        first_cart.cart.released = True
 
        first_cart.cart.save()
 
        first_cart.next_cart()
 

	
...
 
@@ -178,4 +178,4 @@ class CeilingsTestCases(RegistrationCartTestCase):
 

	
 
        cart.cart.active = False
 
        cart.cart.save()
 

	
 
        cart.next_cart()
 

	
registrasion/tests/test_discount.py
Show inline comments
...
 
@@ -170,4 +170,4 @@ class DiscountTestCase(RegistrationCartTestCase):
 
        cart.add_to_cart(self.PROD_1, 1)
 
        cart.cart.active = False
 
        cart.cart.save()
 

	
 
        cart.next_cart()
 

	
...
 
@@ -179,4 +179,4 @@ class DiscountTestCase(RegistrationCartTestCase):
 
        self.assertEqual(1, len(cart.cart.discountitem_set.all()))
 
        cart.cart.active = False
 
        cart.cart.save()
 

	
 
        cart.next_cart()
 

	
...
 
@@ -199,4 +199,4 @@ class DiscountTestCase(RegistrationCartTestCase):
 
        cart.add_to_cart(self.PROD_2, 2)
 
        cart.cart.active = False
 
        cart.cart.save()
 

	
 
        cart.next_cart()
 

	
...
 
@@ -348,4 +348,4 @@ class DiscountTestCase(RegistrationCartTestCase):
 
        self.assertEqual(2, discounts[0].quantity)
 
        cart.cart.active = False
 
        cart.cart.save()
 

	
 
        cart.next_cart()
 

	
...
 
@@ -359,4 +359,4 @@ class DiscountTestCase(RegistrationCartTestCase):
 
        self.assertEqual(1, discounts[0].quantity)
 
        cart.cart.active = False
 
        cart.cart.save()
 

	
 
        cart.next_cart()
 

	
...
 
@@ -390,3 +390,3 @@ class DiscountTestCase(RegistrationCartTestCase):
 
        cart.cart.active = False  # Keep discount enabled
 
        cart.cart.save()
 
        cart.next_cart()
 

	
...
 
@@ -394,4 +394,4 @@ class DiscountTestCase(RegistrationCartTestCase):
 
        cart.add_to_cart(self.PROD_2, 2)  # The discount will be exhausted
 
        cart.cart.active = False
 
        cart.cart.save()
 

	
 
        cart.next_cart()
 

	
...
 
@@ -405,3 +405,3 @@ class DiscountTestCase(RegistrationCartTestCase):
 
        cart.cart.released = True
 
        cart.cart.save()
 
        cart.next_cart()
 

	
registrasion/tests/test_enabling_condition.py
Show inline comments
...
 
@@ -70,4 +70,4 @@ class EnablingConditionTestCases(RegistrationCartTestCase):
 
        current_cart.add_to_cart(self.PROD_2, 1)
 
        current_cart.cart.active = False
 
        current_cart.cart.save()
 

	
 
        current_cart.next_cart()
 

	
...
 
@@ -105,4 +105,4 @@ class EnablingConditionTestCases(RegistrationCartTestCase):
 
        current_cart.add_to_cart(self.PROD_3, 1)
 
        current_cart.cart.active = False
 
        current_cart.cart.save()
 

	
 
        current_cart.next_cart()
 

	
...
 
@@ -243,4 +243,4 @@ class EnablingConditionTestCases(RegistrationCartTestCase):
 

	
 
        cart.cart.active = False
 
        cart.cart.save()
 

	
 
        cart.next_cart()
 

	
...
 
@@ -251,3 +251,3 @@ class EnablingConditionTestCases(RegistrationCartTestCase):
 
        cart.cart.released = True
 
        cart.cart.save()
 
        cart.next_cart()
 

	
...
 
@@ -262,4 +262,4 @@ class EnablingConditionTestCases(RegistrationCartTestCase):
 

	
 
        cart.cart.active = False
 
        cart.cart.save()
 

	
 
        cart.next_cart()
 

	
...
 
@@ -270,3 +270,3 @@ class EnablingConditionTestCases(RegistrationCartTestCase):
 
        cart.cart.released = True
 
        cart.cart.save()
 
        cart.next_cart()
 

	
registrasion/tests/test_voucher.py
Show inline comments
...
 
@@ -36,4 +36,4 @@ class VoucherTestCases(RegistrationCartTestCase):
 
        cart_2.apply_voucher(voucher.code)
 
        cart_2.cart.active = False
 
        cart_2.cart.save()
 

	
 
        cart_2.next_cart()
 

	
...
 
@@ -127,4 +127,4 @@ class VoucherTestCases(RegistrationCartTestCase):
 

	
 
        current_cart.cart.active = False
 
        current_cart.cart.save()
 

	
 
        current_cart.next_cart()
 

	
0 comments (0 inline, 0 general)