def testGetGroups(self): """ """ gm = IGroupManagement(self.shop) ids = [g.getId() for g in gm.getGroups()] self.assertEqual(ids, ["group_1", "group_2"])
def getGroups(self): """Returns groups of the shop. """ shop = self._getShop() gm = IGroupManagement(shop) return gm.getGroups()
def isValid(self, product): """Returns True if given product is at least in one of the selected groups of the criterion. """ pm = IGroupManagement(product) product_groups = [group.getId() for group in pm.getGroups()] criteria_groups = self.context.getGroups() for criteria_group in criteria_groups: if criteria_group in product_groups: return True return False
def testGetGroups_2(self): """ """ cm = IGroupManagement(self.shop.products.product_3) self.assertEqual(cm.getGroups(), [])
def testGetGroups_1(self): """ """ cm = IGroupManagement(self.shop.products.product_1) ids = [g.getId() for g in cm.getGroups()] self.assertEqual(ids, ["group_1", "group_2"])