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

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

        cm = ICartManagement(self.shop)
        cart = cm.getCart()
        
        im = IItemManagement(self.order)
        im.addItemsFromCart(cart)

        product_ids = [item.getProduct().getId() for item in im.getItems()]

        self.assertEqual(product_ids, ["product_1", "product_2"])
Example #2
0
    def testAddItemsFromCart(self):        
        """
        """
        cm = ICartManagement(self.shop)
        cart1 = cm.createCart()
        
        im1 = IItemManagement(cart1)
        
        im1.addItem(self.product_1, properties=())
        im1.addItem(self.product_2, properties=(), quantity=3)
        
        self.login("newmember")
        cart2 = cm.createCart()

        im2 = IItemManagement(cart2)
        im2.addItemsFromCart(cart1)
        
        self.assertEqual(len(im2.getItems()), 2)
Example #3
0
    def testAddItemsFromCart(self):
        """
        """
        cm = ICartManagement(self.shop)
        cart1 = cm.createCart()

        im1 = IItemManagement(cart1)

        im1.addItem(self.product_1, properties=())
        im1.addItem(self.product_2, properties=(), quantity=3)

        self.login("newmember")
        cart2 = cm.createCart()

        im2 = IItemManagement(cart2)
        im2.addItemsFromCart(cart1)

        self.assertEqual(len(im2.getItems()), 2)
    def testAddItemsFromCart(self):
        """
        """
        view = getMultiAdapter((self.shop.products.product_1,
                                self.shop.products.product_1.REQUEST),
                               name="addToCart")
        view.addToCart()

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

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

        im = IItemManagement(self.order)
        im.addItemsFromCart(cart)

        product_ids = [item.getProduct().getId() for item in im.getItems()]

        self.assertEqual(product_ids, ["product_1", "product_2"])