server/test/unittest_msplanner.py
changeset 6957 ffda12be2e9f
parent 6944 0cf10429ad39
child 7108 bcdf22734059
equal deleted inserted replaced
6956:b172c383dbce 6957:ffda12be2e9f
    56     cross_relations = set(('multisource_crossed_rel',))
    56     cross_relations = set(('multisource_crossed_rel',))
    57 
    57 
    58     def syntax_tree_search(self, *args, **kwargs):
    58     def syntax_tree_search(self, *args, **kwargs):
    59         return []
    59         return []
    60 
    60 
       
    61 
       
    62 class FakeDataFeedSource(FakeCardSource):
       
    63     copy_based_source = True
       
    64 
    61 X_ALL_SOLS = sorted([{'X': 'Affaire'}, {'X': 'BaseTransition'}, {'X': 'Basket'},
    65 X_ALL_SOLS = sorted([{'X': 'Affaire'}, {'X': 'BaseTransition'}, {'X': 'Basket'},
    62                      {'X': 'Bookmark'}, {'X': 'CWAttribute'}, {'X': 'CWCache'},
    66                      {'X': 'Bookmark'}, {'X': 'CWAttribute'}, {'X': 'CWCache'},
    63                      {'X': 'CWConstraint'}, {'X': 'CWConstraintType'}, {'X': 'CWEType'},
    67                      {'X': 'CWConstraint'}, {'X': 'CWConstraintType'}, {'X': 'CWEType'},
    64                      {'X': 'CWGroup'}, {'X': 'CWPermission'}, {'X': 'CWProperty'},
    68                      {'X': 'CWGroup'}, {'X': 'CWPermission'}, {'X': 'CWProperty'},
    65                      {'X': 'CWRType'}, {'X': 'CWRelation'},
    69                      {'X': 'CWRType'}, {'X': 'CWRelation'},
   108         self.prevrqlexpr_user = userreadperms[-1]
   112         self.prevrqlexpr_user = userreadperms[-1]
   109         userreadperms[-1] = ERQLExpression('X owned_by U')
   113         userreadperms[-1] = ERQLExpression('X owned_by U')
   110         self.schema['CWUser'].set_action_permissions('read', userreadperms)
   114         self.schema['CWUser'].set_action_permissions('read', userreadperms)
   111         self.add_source(FakeUserROSource, 'ldap')
   115         self.add_source(FakeUserROSource, 'ldap')
   112         self.add_source(FakeCardSource, 'cards')
   116         self.add_source(FakeCardSource, 'cards')
       
   117         self.add_source(FakeDataFeedSource, 'datafeed')
   113 
   118 
   114     def tearDown(self):
   119     def tearDown(self):
   115         # restore hijacked security
   120         # restore hijacked security
   116         self.restore_orig_affaire_security()
   121         self.restore_orig_affaire_security()
   117         self.restore_orig_cwuser_security()
   122         self.restore_orig_cwuser_security()
  1953                                        [{'S': 'CWSource', 'SN': 'String', 'X': 'Card'}])],
  1958                                        [{'S': 'CWSource', 'SN': 'String', 'X': 'Card'}])],
  1954                      None, None, [self.system], {}, [])
  1959                      None, None, [self.system], {}, [])
  1955                     ])
  1960                     ])
  1956 
  1961 
  1957     def test_source_specified_1_2(self):
  1962     def test_source_specified_1_2(self):
       
  1963         self._test('Card X WHERE X cw_source S, S name "datafeed"',
       
  1964                    [('OneFetchStep', [('Any X WHERE X cw_source S, S name "datafeed", X is Card',
       
  1965                                        [{'X': 'Card', 'S': 'CWSource'}])],
       
  1966                      None, None,
       
  1967                      [self.system],{}, [])
       
  1968                     ])
       
  1969 
       
  1970     def test_source_specified_1_3(self):
       
  1971         self._test('Any X, SN WHERE X is Card, X cw_source S, S name "datafeed", S name SN',
       
  1972                    [('OneFetchStep', [('Any X,SN WHERE X is Card, X cw_source S, S name "datafeed", '
       
  1973                                        'S name SN',
       
  1974                                        [{'S': 'CWSource', 'SN': 'String', 'X': 'Card'}])],
       
  1975                      None, None, [self.system], {}, [])
       
  1976                     ])
       
  1977 
       
  1978     def test_source_specified_1_4(self):
  1958         sols = []
  1979         sols = []
  1959         for sol in X_ALL_SOLS:
  1980         for sol in X_ALL_SOLS:
  1960             sol = sol.copy()
  1981             sol = sol.copy()
  1961             sol['S'] = 'CWSource'
  1982             sol['S'] = 'CWSource'
  1962             sols.append(sol)
  1983             sols.append(sol)
  2002                        [{'X': 'Card', 'XT': 'String'}])],
  2023                        [{'X': 'Card', 'XT': 'String'}])],
  2003                      None, None, [self.cards], {}, [])
  2024                      None, None, [self.cards], {}, [])
  2004                     ])
  2025                     ])
  2005 
  2026 
  2006     def test_source_specified_3_2(self):
  2027     def test_source_specified_3_2(self):
       
  2028         self._test('Any X,XT WHERE X is Card, X title XT, X cw_source S, S name "datafeed"',
       
  2029                    [('OneFetchStep',
       
  2030                      [('Any X,XT WHERE X is Card, X title XT, X cw_source S, S name "datafeed"',
       
  2031                        [{'X': 'Card', 'XT': 'String', 'S': 'CWSource'}])],
       
  2032                      None, None, [self.system], {}, [])
       
  2033                     ])
       
  2034 
       
  2035     def test_source_specified_3_3(self):
  2007         self.skipTest('oops')
  2036         self.skipTest('oops')
  2008         self._test('Any STN WHERE X is Note, X type XT, X in_state ST, ST name STN, X cw_source S, S name "cards"',
  2037         self._test('Any STN WHERE X is Note, X type XT, X in_state ST, ST name STN, X cw_source S, S name "cards"',
  2009                    [('OneFetchStep',
  2038                    [('OneFetchStep',
  2010                      [('Any X,XT WHERE X is Card, X title XT',
  2039                      [('Any X,XT WHERE X is Card, X title XT',
  2011                        [{'X': 'Card', 'XT': 'String'}])],
  2040                        [{'X': 'Card', 'XT': 'String'}])],