示例#1
0
    def testDeleteItemByOrd(self):
        """
        """
        self.logout()

        cm = ICartManagement(self.shop)
        cart = cm.createCart()
        
        im = IItemManagement(cart)
        
        im.addItem(self.product_1, properties=())
        self.assertEqual(len(im.getItems()), 1)

        im.addItem(self.product_2, properties=(), quantity=3)
        self.assertEqual(len(im.getItems()), 2)

        # Try to delete non existing ord
        result = im.deleteItemByOrd(3)
        self.assertEqual(result, False)

        # Still 2 items in there
        self.assertEqual(len(im.getItems()), 2)
        
        # delete first item
        result = im.deleteItemByOrd(0)
        self.assertEqual(result, True)        
        self.assertEqual(len(im.getItems()), 1)

        # Once again, but now it should be another
        result = im.deleteItemByOrd(0)
        self.assertEqual(result, True)        
        self.assertEqual(len(im.getItems()), 0)
示例#2
0
    def testDeleteItemByOrd(self):
        """
        """
        self.logout()

        cm = ICartManagement(self.shop)
        cart = cm.createCart()

        im = IItemManagement(cart)

        im.addItem(self.product_1, properties=())
        self.assertEqual(len(im.getItems()), 1)

        im.addItem(self.product_2, properties=(), quantity=3)
        self.assertEqual(len(im.getItems()), 2)

        # Try to delete non existing ord
        result = im.deleteItemByOrd(3)
        self.assertEqual(result, False)

        # Still 2 items in there
        self.assertEqual(len(im.getItems()), 2)

        # delete first item
        result = im.deleteItemByOrd(0)
        self.assertEqual(result, True)
        self.assertEqual(len(im.getItems()), 1)

        # Once again, but now it should be another
        result = im.deleteItemByOrd(0)
        self.assertEqual(result, True)
        self.assertEqual(len(im.getItems()), 0)
示例#3
0
    def testDeleteItemByOrd(self):
        """
        """
        self.login("newmember")
    
        view = getMultiAdapter((self.shop.products.product_1, self.shop.products.product_1.REQUEST), name="addToCart")
        view.addToCart()

        cart = ICartManagement(self.shop).getCart()    
        im = IItemManagement(cart)            
        im.deleteItemByOrd(0)
    
        self.failIf(hasattr(cart, "0"))
示例#4
0
    def testDeleteItemByOrd(self):
        """
        """
        self.login("newmember")

        view = getMultiAdapter((self.shop.products.product_1,
                                self.shop.products.product_1.REQUEST),
                               name="addToCart")
        view.addToCart()

        cart = ICartManagement(self.shop).getCart()
        im = IItemManagement(cart)
        im.deleteItemByOrd(0)

        self.failIf(hasattr(cart, "0"))