Commit cf5fbcfe authored by Jérome Perrin's avatar Jérome Perrin

don't use 'if obj', it's a coding crime.

Add test for Predicate_getMembershipCriterionCategoryList


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13733 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f23bf49b
......@@ -85,7 +85,7 @@ for item in mixed_list:\n
if item_list == [[\'\', \'\']]:\n
for fallback_category in base_category.getFallbackBaseCategoryList():\n
fallback_category = ctool.restrictedTraverse(fallback_category, None)\n
if fallback_category:\n
if fallback_category is not None and fallback_category.objectIds():\n
item_list = [(\'%s/%s\' % (item, x[0]), \'%s/%s\' % (item, x[1])) for x in\n
fallback_category.getCategoryChildCompactLogicalPathItemList(base=1)]\n
break\n
......
282
\ No newline at end of file
284
\ No newline at end of file
......@@ -378,6 +378,31 @@ class TestPredicates(ERP5TypeTestCase):
self.assertEquals([True, False, True, False], calls)
def test_Predicate_getMembershipCriterionCategoryList(self):
# Predicate_getMembershipCriterionCategoryList is a script used to show the
# item list in Predicate_view/my_membership_criterion_category_list.
# When called on a predicate using a simple category (like region) as
# membership criterion base category, it will show for values the content
# of this category.
pred = self.createPredicate(
membership_criterion_base_category_list=['region'], )
self.failUnless(('europe/western_europe', 'region/europe/western_europe') in
[tuple(x) for x in pred.Predicate_getMembershipCriterionCategoryList()],
pred.Predicate_getMembershipCriterionCategoryList(),)
# If this category is empty, it will show values from fallback category,
# with the path they have when they are acquired
pred = self.createPredicate(
membership_criterion_base_category_list=['source_region'], )
# note that the id of the actual base category is displayed in the first
# item too, for making it clear in the UI that it's the content of a
# category used for another base category.
self.failUnless(('source_region/europe/western_europe',
'source_region/region/europe/western_europe') in
[tuple(x) for x in pred.Predicate_getMembershipCriterionCategoryList()],
pred.Predicate_getMembershipCriterionCategoryList(),)
def test_PredicateFusion(self, quiet=QUIET, run=RUN_ALL_TESTS):
"""Test simple predicates fusion.
New predicate act as a logical AND between predicates
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment