Ejemplo n.º 1
0
 def test_check_basket_is_valid_no_stock_available(self):
     self.add_product_to_basket(self.product)
     CheckoutSessionMixin().check_basket_is_valid(self.request)
     self.stock_record.allocate(10)
     self.stock_record.save()
     with self.assertRaises(FailedPreCondition):
         CheckoutSessionMixin().check_basket_is_valid(self.request)
Ejemplo n.º 2
0
 def test_check_basket_is_valid_stock_exceeded(self):
     self.add_product_to_basket(self.product)
     CheckoutSessionMixin().check_basket_is_valid(self.request)
     self.request.basket.add_product(self.product, quantity=11)
     with self.assertRaises(FailedPreCondition):
         CheckoutSessionMixin().check_basket_is_valid(self.request)