Beispiel #1
0
 def test_quantity(self):
     'Is ReplaceCartLineForm works with correct quantity value'
     form = ReplaceCartLineForm({'quantity': 5},
                                cart=self.cart,
                                product=stock_product)
     self.assertTrue(form.is_valid())
     form.save()
     form = ReplaceCartLineForm({'quantity': 5},
                                cart=self.cart,
                                product=stock_product)
     self.assertTrue(form.is_valid())
     form.save()
     product_quantity = self.cart.get_line(stock_product).quantity
     self.assertEqual(product_quantity, 5,
                      '%s is the bad quantity value' % (product_quantity, ))
Beispiel #2
0
 def test_quantity(self):
     'Is ReplaceCartLineForm works with correct quantity value'
     form = ReplaceCartLineForm({'quantity': 5}, cart=self.cart,
                                product=stock_product)
     self.assertTrue(form.is_valid())
     form.save()
     form = ReplaceCartLineForm({'quantity': 5}, cart=self.cart,
                                product=stock_product)
     self.assertTrue(form.is_valid())
     form.save()
     product_quantity = self.cart.get_line(stock_product).quantity
     self.assertEqual(product_quantity, 5,
                      '%s is the bad quantity value' % (product_quantity,))
Beispiel #3
0
 def test_too_big_quantity(self):
     'Is ReplaceCartLineForm works with to big quantity value'
     form = ReplaceCartLineForm({'quantity': 15},
                                cart=self.cart,
                                product=stock_product)
     self.assertFalse(form.is_valid())
Beispiel #4
0
 def test_too_big_quantity(self):
     'Is ReplaceCartLineForm works with to big quantity value'
     form = ReplaceCartLineForm({'quantity': 15}, cart=self.cart,
                                product=stock_product)
     self.assertFalse(form.is_valid())