server/test/unittest_msplanner.py
changeset 1121 43fa67acd9d0
parent 1120 1c24cde4bf72
child 1122 9f37de24251f
equal deleted inserted replaced
1120:1c24cde4bf72 1121:43fa67acd9d0
  1816                         'Z': 'table1.C1'},
  1816                         'Z': 'table1.C1'},
  1817                        [])]
  1817                        [])]
  1818                       )],
  1818                       )],
  1819                    {'x': 999999})
  1819                    {'x': 999999})
  1820 
  1820 
  1821     def test_nonregr13(self):
  1821     def test_nonregr13_1(self):
       
  1822         # identity wrapped into exists
  1822         self._test('Any B,U,UL GROUPBY B,U,UL WHERE B created_by U?, B is File '
  1823         self._test('Any B,U,UL GROUPBY B,U,UL WHERE B created_by U?, B is File '
  1823                    'WITH U,UL BEING (Any U,UL WHERE ME eid %(x)s, (EXISTS(U identity ME) '
  1824                    'WITH U,UL BEING (Any U,UL WHERE ME eid %(x)s, (EXISTS(U identity ME) '
  1824                    'OR (EXISTS(U in_group G, G name IN("managers", "staff")))) '
  1825                    'OR (EXISTS(U in_group G, G name IN("managers", "staff")))) '
  1825                    'OR (EXISTS(U in_group H, ME in_group H, NOT H name "users")), U login UL, U is EUser)',
  1826                    'OR (EXISTS(U in_group H, ME in_group H, NOT H name "users")), U login UL, U is EUser)',
  1826                    [('FetchStep', [('Any U,UL WHERE U login UL, U is EUser',
  1827                    [('FetchStep', [('Any U,UL WHERE U login UL, U is EUser',
  1838                                        [{'B': 'File', 'U': 'EUser', 'UL': 'String'}])],
  1839                                        [{'B': 'File', 'U': 'EUser', 'UL': 'String'}])],
  1839                      None, None, [self.system],
  1840                      None, None, [self.system],
  1840                      {'U': 'table1.C0', 'UL': 'table1.C1'},
  1841                      {'U': 'table1.C0', 'UL': 'table1.C1'},
  1841                      [])],
  1842                      [])],
  1842                    {'x': self.session.user.eid})
  1843                    {'x': self.session.user.eid})
       
  1844         
       
  1845     def test_nonregr13_2(self):
       
  1846         # identity *not* wrapped into exists.
       
  1847         #
       
  1848         # XXX this test fail since in this case, in "U identity 5" U and 5 are
       
  1849         # from the same scope so constraints are applied (telling the U should
       
  1850         # come from the same source as user with eid 5).
       
  1851         #
       
  1852         # IMO this is normal, unless we introduce a special case for the
       
  1853         # identity relation. BUT I think it's better to leave it as is and to
       
  1854         # explain constraint propagation rules, and so why this should be
       
  1855         # wrapped in exists() is used in multi-source
       
  1856         self.skip('take a look at me if you wish')
       
  1857         self._test('Any B,U,UL GROUPBY B,U,UL WHERE B created_by U?, B is File '
       
  1858                    'WITH U,UL BEING (Any U,UL WHERE ME eid %(x)s, (U identity ME '
       
  1859                    'OR (EXISTS(U in_group G, G name IN("managers", "staff")))) '
       
  1860                    'OR (EXISTS(U in_group H, ME in_group H, NOT H name "users")), U login UL, U is EUser)',
       
  1861                    [('FetchStep', [('Any U,UL WHERE U login UL, U is EUser',
       
  1862                                     [{'U': 'EUser', 'UL': 'String'}])],
       
  1863                      [self.ldap, self.system], None,
       
  1864                      {'U': 'table0.C0', 'U.login': 'table0.C1', 'UL': 'table0.C1'},
       
  1865                      []),
       
  1866                     ('FetchStep', [('Any U,UL WHERE ((U identity 5) OR (EXISTS(U in_group G, G name IN("managers", "staff"), G is EGroup))) OR (EXISTS(U in_group H, 5 in_group H, NOT H name "users", H is EGroup)), U login UL, U is EUser',
       
  1867                                     [{'G': 'EGroup', 'H': 'EGroup', 'U': 'EUser', 'UL': 'String'}])],
       
  1868                      [self.system],
       
  1869                      {'U': 'table0.C0', 'U.login': 'table0.C1', 'UL': 'table0.C1'},
       
  1870                      {'U': 'table1.C0', 'U.login': 'table1.C1', 'UL': 'table1.C1'},
       
  1871                      []),
       
  1872                     ('OneFetchStep', [('Any B,U,UL GROUPBY B,U,UL WHERE B created_by U?, B is File',
       
  1873                                        [{'B': 'File', 'U': 'EUser', 'UL': 'String'}])],
       
  1874                      None, None, [self.system],
       
  1875                      {'U': 'table1.C0', 'UL': 'table1.C1'},
       
  1876                      [])],
       
  1877                    {'x': self.session.user.eid})
       
  1878 
  1843 
  1879 
  1844 class MSPlannerTwoSameExternalSourcesTC(BasePlannerTC):
  1880 class MSPlannerTwoSameExternalSourcesTC(BasePlannerTC):
  1845     """test planner related feature on a 3-sources repository:
  1881     """test planner related feature on a 3-sources repository:
  1846     
  1882     
  1847     * 2 rql source supporting Card
  1883     * 2 rql source supporting Card