File diff 61dbe60cfad0 → 87e6fa064a11
registrasion/tests/test_voucher.py
Show inline comments
...
 
@@ -49,32 +49,32 @@ class VoucherTestCases(RegistrationCartTestCase):
 
        # User has an exhausted voucher leftover from test_apply_voucher
 
        cart_1 = TestingCartController.for_user(self.USER_1)
 
        with self.assertRaises(ValidationError):
 
            cart_1.validate_cart()
 

	
 
        cart_1.fix_simple_errors()
 
        # This should work now.
 
        cart_1.validate_cart()
 

	
 
    def test_voucher_enables_item(self):
 
        voucher = self.new_voucher()
 

	
 
        enabling_condition = rego.VoucherEnablingCondition.objects.create(
 
        flag = rego.VoucherFlag.objects.create(
 
            description="Voucher condition",
 
            voucher=voucher,
 
            mandatory=False,
 
            condition=rego.FlagBase.ENABLE_IF_TRUE,
 
        )
 
        enabling_condition.save()
 
        enabling_condition.products.add(self.PROD_1)
 
        enabling_condition.save()
 
        flag.save()
 
        flag.products.add(self.PROD_1)
 
        flag.save()
 

	
 
        # Adding the product without a voucher will not work
 
        current_cart = TestingCartController.for_user(self.USER_1)
 
        with self.assertRaises(ValidationError):
 
            current_cart.add_to_cart(self.PROD_1, 1)
 

	
 
        # Apply the voucher
 
        current_cart.apply_voucher(voucher.code)
 
        current_cart.add_to_cart(self.PROD_1, 1)
 

	
 
    def test_voucher_enables_discount(self):
 
        voucher = self.new_voucher()