Exemplo n.º 1
0
    def testGetAmountOfProducts_1(self):
        """As manager
        """
        pm = IProductManagement(self.shop.groups.group_1)
        self.assertEqual(len(pm.getProducts()), 2)

        pm = IProductManagement(self.shop.groups.group_2)
        self.assertEqual(len(pm.getProducts()), 1)
    def testGetAmountOfProducts_1(self):
        """As manager
        """
        pm = IProductManagement(self.shop.groups.group_1)
        self.assertEqual(len(pm.getProducts()), 2)

        pm = IProductManagement(self.shop.groups.group_2)
        self.assertEqual(len(pm.getProducts()), 1)
Exemplo n.º 3
0
    def testGetAmountOfProducts_2(self):
        """As anonymous. Note that only products are counted for which the user
        has the View permission.
        """
        self.logout()
        pm = IProductManagement(self.shop.groups.group_1)
        self.assertEqual(len(pm.getProducts()), 0)

        pm = IProductManagement(self.shop.groups.group_2)
        self.assertEqual(len(pm.getProducts()), 0)
Exemplo n.º 4
0
    def testGetProducts_1(self):
        """As manager
        """
        pm = IProductManagement(self.shop.groups.group_1)
        product_ids = [p.getId() for p in pm.getProducts()]
        self.assertEqual(product_ids, ["product_1", "product_2"])

        pm = IProductManagement(self.shop.groups.group_2)
        product_ids = [p.getId() for p in pm.getProducts()]
        self.assertEqual(product_ids, ["product_1"])
    def testGetAmountOfProducts_2(self):
        """As anonymous. Note that only products are counted for which the user
        has the View permission.
        """
        self.logout()
        pm = IProductManagement(self.shop.groups.group_1)
        self.assertEqual(len(pm.getProducts()), 0)

        pm = IProductManagement(self.shop.groups.group_2)
        self.assertEqual(len(pm.getProducts()), 0)
    def testGetProducts_1(self):
        """As manager
        """
        pm = IProductManagement(self.shop.groups.group_1)
        product_ids = [p.getId() for p in pm.getProducts()]        
        self.assertEqual(product_ids, ["product_1", "product_2"])

        pm = IProductManagement(self.shop.groups.group_2)
        product_ids = [p.getId() for p in pm.getProducts()]        
        self.assertEqual(product_ids, ["product_1"])
Exemplo n.º 7
0
    def testGetProducts(self):
        """
        """
        pm = IProductManagement(self.portal.myshop.categories.category_1)
        self.assertEqual(pm.getProducts(), [])

        pm = IProductManagement(self.portal.myshop.categories.category_2)
        self.assertEqual(pm.getProducts(), [])

        pm = IProductManagement(self.portal.myshop.categories.category_1.category_11)
        product_ids = [p.getId() for p in pm.getProducts()]
        self.assertEqual(product_ids, ["product_1", "product_2"])
Exemplo n.º 8
0
    def testGetAmountOfProducts_3(self):
        """As anonymous, with product_2 published.
        """
        wftool = getToolByName(self.shop, "portal_workflow")
        wftool.doActionFor(self.product_2, "publish")

        self.logout()

        pm = IProductManagement(self.shop.groups.group_1)
        self.assertEqual(len(pm.getProducts()), 1)

        pm = IProductManagement(self.shop.groups.group_2)
        self.assertEqual(len(pm.getProducts()), 0)
Exemplo n.º 9
0
    def testGetProducts_2(self):
        """As anonymous. Note hat only products return for which the user has
        the View permission.
        """
        self.logout()

        pm = IProductManagement(self.shop.groups.group_1)
        product_ids = [p.getId() for p in pm.getProducts()]
        self.assertEqual(product_ids, [])

        pm = IProductManagement(self.shop.groups.group_2)
        product_ids = [p.getId() for p in pm.getProducts()]
        self.assertEqual(product_ids, [])
Exemplo n.º 10
0
    def testGetAmountOfProducts_3(self):
        """As anonymous, with product_2 published.
        """
        wftool = getToolByName(self.shop, "portal_workflow")
        wftool.doActionFor(self.product_2, "publish")
        
        self.logout()

        pm = IProductManagement(self.shop.groups.group_1)
        self.assertEqual(len(pm.getProducts()), 1)

        pm = IProductManagement(self.shop.groups.group_2)
        self.assertEqual(len(pm.getProducts()), 0)
Exemplo n.º 11
0
    def testGetProducts_2(self):
        """As anonymous. Note hat only products return for which the user has
        the View permission.
        """
        self.logout()
        
        pm = IProductManagement(self.shop.groups.group_1)
        product_ids = [p.getId() for p in pm.getProducts()]
        self.assertEqual(product_ids, [])

        pm = IProductManagement(self.shop.groups.group_2)
        product_ids = [p.getId() for p in pm.getProducts()]        
        self.assertEqual(product_ids, [])
Exemplo n.º 12
0
    def testGetProducts_3(self):
        """As anonymous, with product_2 published.
        """
        wftool = getToolByName(self.shop, "portal_workflow")
        wftool.doActionFor(self.product_2, "publish")

        self.logout()

        pm = IProductManagement(self.shop.groups.group_1)
        product_ids = [p.getId() for p in pm.getProducts()]

        for id in ["product_1", "product_2"]:
            self.failUnless(id not in product_ids)

        pm = IProductManagement(self.shop.groups.group_2)
        product_ids = [p.getId() for p in pm.getProducts()]
        self.assertEqual(product_ids, [])
Exemplo n.º 13
0
    def testGetProducts_3(self):
        """As anonymous, with product_2 published.
        """
        wftool = getToolByName(self.shop, "portal_workflow")
        wftool.doActionFor(self.product_2, "publish")
        
        self.logout()
        
        pm = IProductManagement(self.shop.groups.group_1)
        product_ids = [p.getId() for p in pm.getProducts()]        
        
        for id in ["product_1", "product_2"]:
            self.failUnless(id not in product_ids)

        pm = IProductManagement(self.shop.groups.group_2)
        product_ids = [p.getId() for p in pm.getProducts()]        
        self.assertEqual(product_ids, [])
Exemplo n.º 14
0
 def testGetProducts(self):
     """
     """
     pm = IProductManagement(self.shop)
     self.failIf(pm.getProducts() == 0)