def testAddProductAsAnonymousAndMember(self): """Proves that a member will overtake the cart items, which he has added, as anonymous user. """ self.logout() view = getMultiAdapter((self.shop.products.product_2, self.shop.products.product_2.REQUEST), name="addToCart") view.addToCart() cart = ICartManagement(self.shop).getCart() items = IItemManagement(cart).getItems() self.assertEqual(len(items), 1) view.addToCart() items = IItemManagement(cart).getItems() self.assertEqual(len(items), 1) view = getMultiAdapter((self.shop.products.product_1, self.shop.products.product_1.REQUEST), name="addToCart") view.addToCart() items = IItemManagement(cart).getItems() self.assertEqual(len(items), 2) self.login("newmember") cart = ICartManagement(self.shop).getCart() items = IItemManagement(cart).getItems() self.assertEqual(len(items), 2) self.assertEqual(cart.getId(), "newmember")