Commit 7dde87f6 authored by Nicolas Dumazet's avatar Nicolas Dumazet

test for tales_expression field of predicates


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41814 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9b568d75
......@@ -589,6 +589,19 @@ class TestPredicates(TestPredicateMixIn):
self.assertSameSet(set([x.getObject() for x in predicate.searchResults(portal_type=['Person',
'Organisation'])]), set([fabien, nexedi]))
def test_TalesExpression(self):
# Predicates can test that a document is member of a category
doc = self.createDocument(region='europe/western_europe/france',)
pred_false = self.createPredicate(
test_tales_expression="python: 'japan' in here.getRegion()")
# our document is member of france region, so the predicate is false
self.assertFalse(pred_false.test(doc))
pred_true = self.createPredicate(
test_tales_expression="python: 'france' in here.getRegion()")
self.assertTrue(pred_true.test(doc))
# TODO :
# multi membership category
......
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