From 432a705f428417c32c6411003dc28b48fa69d76d Mon Sep 17 00:00:00 2001 From: Yusei Tahara <yusei@nexedi.com> Date: Fri, 16 Nov 2007 13:32:11 +0000 Subject: [PATCH] Add tests for sql generation. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17648 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/tests/testPredicate.py | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/product/ERP5/tests/testPredicate.py b/product/ERP5/tests/testPredicate.py index 8a4fa6a251..463dfce9ec 100644 --- a/product/ERP5/tests/testPredicate.py +++ b/product/ERP5/tests/testPredicate.py @@ -491,6 +491,38 @@ class TestPredicates(ERP5TypeTestCase): stepAssertPredicateFalse """) + def test_MembershipCriterion_SQLQuery(self, quiet=QUIET, run=RUN_ALL_TESTS): + """ + Make sure that predicate generate valid sql. + """ + if not run : return + + predicate_without_membership_values = self.createPredicate( + membership_criterion_base_category_list=['group']) + self.assert_(predicate_without_membership_values.searchResults()) + + predicate_with_membership_values = self.createPredicate( + membership_criterion_base_category_list=['group'], + membership_criterion_category_list=GROUP_STOREVER_PATH, + ) + self.assert_(predicate_with_membership_values.searchResults()) + + def test_MultiValuedMembershipCriterion_SQLQuery(self, quiet=QUIET, run=RUN_ALL_TESTS): + """ + Make sure that predicate generate valid sql. + """ + if not run : return + + predicate_without_membership_values = self.createPredicate( + multimembership_criterion_base_category_list=['group']) + self.assert_(predicate_without_membership_values.searchResults()) + + predicate_with_membership_values = self.createPredicate( + multimembership_criterion_base_category_list=['group'], + membership_criterion_category_list=GROUP_STOREVER_PATH, + ) + self.assert_(predicate_with_membership_values.searchResults()) + # TODO : # multi membership category # asPredicate scripts -- 2.30.9