server/test/unittest_msplanner.py
branchstable
changeset 2075 933ccfce6e91
parent 2074 9e268cb6202e
child 2076 65cbe891edac
equal deleted inserted replaced
2074:9e268cb6202e 2075:933ccfce6e91
  2071                      None, None, [self.cards], {}, []
  2071                      None, None, [self.cards], {}, []
  2072                      )],
  2072                      )],
  2073                    {'x': 999999})
  2073                    {'x': 999999})
  2074 
  2074 
  2075 
  2075 
       
  2076 
       
  2077 class FakeVCSSource(AbstractSource):
       
  2078     uri = 'ccc'
       
  2079     support_entities = {'Card': True, 'Note': True}
       
  2080     support_relations = {'multisource_inlined_rel': True,
       
  2081                          'multisource_rel': True}
       
  2082     #dont_cross_relations = set(('fiche', 'in_state'))
       
  2083     #cross_relations = set(('multisource_crossed_rel',))
       
  2084 
       
  2085     def syntax_tree_search(self, *args, **kwargs):
       
  2086         return []
       
  2087 
       
  2088 class MSPlannerVCSSource(BasePlannerTC):
       
  2089     repo = repo
       
  2090 
       
  2091     def setUp(self):
       
  2092         self.setup()
       
  2093         self.add_source(FakeVCSSource, 'vcs')
       
  2094         self.planner = MSPlanner(self.o.schema, self.o._rqlhelper)
       
  2095     _test = test_plan
       
  2096 
       
  2097     def test_multisource_inlined_rel_skipped(self):
       
  2098         self._test('Any MAX(VC) '
       
  2099                    'WHERE VC multisource_inlined_rel R2, R para %(branch)s, VC in_state S, S name "published", '
       
  2100                    '(EXISTS(R identity R2)) OR (EXISTS(R multisource_rel R2))',
       
  2101                    [('FetchStep', [('Any VC WHERE VC multisource_inlined_rel R2, R para "???", (EXISTS(R identity R2)) OR (EXISTS(R multisource_rel R2)), R is Note, R2 is Note, VC is Note',
       
  2102                                     [{'R': 'Note', 'R2': 'Note', 'VC': 'Note'}])],
       
  2103                      [self.vcs, self.system], None,
       
  2104                      {'VC': 'table0.C0'},
       
  2105                      []),
       
  2106                     ('OneFetchStep', [(u'Any MAX(VC) WHERE VC in_state S, S name "published", S is State, VC is Note',
       
  2107                                        [{'S': 'State', 'VC': 'Note'}])],
       
  2108                      None, None, [self.system],
       
  2109                      {'VC': 'table0.C0'},
       
  2110                      [])
       
  2111                     ])
       
  2112 
       
  2113 
  2076 if __name__ == '__main__':
  2114 if __name__ == '__main__':
  2077     from logilab.common.testlib import unittest_main
  2115     from logilab.common.testlib import unittest_main
  2078     unittest_main()
  2116     unittest_main()