[multi-source] add test case for an encountered bug, fixed by adding state_of to dont_cross_relations. Added a note to remind me that something should be done to be smarter in handling this stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 09 Oct 2009 19:20:38 +0200
branchstable
changeset 3633 2d81178bea5f
parent 3632 874f5a73e89f
child 3634 a2d00ff6eb68
[multi-source] add test case for an encountered bug, fixed by adding state_of to dont_cross_relations. Added a note to remind me that something should be done to be smarter in handling this
server/sources/__init__.py
server/test/unittest_msplanner.py
--- a/server/sources/__init__.py	Fri Oct 09 19:19:30 2009 +0200
+++ b/server/sources/__init__.py	Fri Oct 09 19:20:38 2009 +0200
@@ -191,6 +191,9 @@
         * if this source doesn't support the relation, can be crossed unless
           explicitly specified in .dont_cross_relations
         """
+        # XXX find a way to have relation such as state_of in dont cross
+        #     relation (eg composite relation without both end type available?
+        #     card 1 relation ? ...)
         if self.support_relation(rtype):
             return rtype in self.cross_relations
         return rtype not in self.dont_cross_relations
--- a/server/test/unittest_msplanner.py	Fri Oct 09 19:19:30 2009 +0200
+++ b/server/test/unittest_msplanner.py	Fri Oct 09 19:20:38 2009 +0200
@@ -37,7 +37,7 @@
     support_entities = {'Card': True, 'Note': True, 'State': True}
     support_relations = {'in_state': True, 'multisource_rel': True, 'multisource_inlined_rel': True,
                          'multisource_crossed_rel': True}
-    dont_cross_relations = set(('fiche', 'in_state'))
+    dont_cross_relations = set(('fiche', 'state_of'))
     cross_relations = set(('multisource_crossed_rel',))
 
     def syntax_tree_search(self, *args, **kwargs):
@@ -1977,6 +1977,14 @@
                      None, None, [self.system], {}, [])],
                    {'x': 999999, 'u': 999998})
 
+    def test_state_of_cross(self):
+        self._test('DELETE State X WHERE NOT X state_of Y',
+                   [('DeleteEntitiesStep',
+                     [('OneFetchStep',
+                       [('Any X WHERE NOT X state_of Y, X is State, Y is Workflow',
+                         [{'X': 'State', 'Y': 'Workflow'}])],
+                       None, None, [self.system], {}, [])])]
+                   )
 
 class MSPlannerTwoSameExternalSourcesTC(BasePlannerTC):
     """test planner related feature on a 3-sources repository: