server/test/unittest_msplanner.py
branchstable
changeset 5420 09b50d7e5321
parent 4915 d657b89df9f4
child 5421 8167de96c523
--- a/server/test/unittest_msplanner.py	Tue Apr 27 18:27:43 2010 +0200
+++ b/server/test/unittest_msplanner.py	Tue Apr 27 18:31:42 2010 +0200
@@ -625,7 +625,6 @@
         2. return the result of Any X,Y WHERE X login 'syt', Y login 'adim'
            on the system source
         """
-        ueid = self.session.user.eid
         self._test('Any X,Y LIMIT 10 OFFSET 10 WHERE X login "syt", Y login "adim"',
                    [('FetchStep',
                      [('Any X WHERE X login "syt", X is CWUser', [{'X': 'CWUser'}])],
@@ -637,7 +636,7 @@
                      [('Any X,Y LIMIT 10 OFFSET 10 WHERE X is CWUser, Y is CWUser', [{'X': 'CWUser', 'Y': 'CWUser'}])],
                      10, 10, [self.system],
                      {'X': 'table0.C0', 'Y': 'table1.C0'}, [])
-                    ], {'x': ueid})
+                    ])
 
     def test_complex_aggregat(self):
         self._test('Any MAX(X)',
@@ -1417,7 +1416,7 @@
                      [])],
                    {'E': self.session.user.eid})
 
-    def test_eid_dont_cross_relation(self):
+    def test_eid_dont_cross_relation_1(self):
         repo._type_source_cache[999999] = ('Personne', 'system', 999999)
         self._test('Any Y,YT WHERE X eid %(x)s, X fiche Y, Y title YT',
                    [('OneFetchStep', [('Any Y,YT WHERE X eid 999999, X fiche Y, Y title YT',
@@ -1425,6 +1424,18 @@
                      None, None, [self.system], {}, [])],
                    {'x': 999999})
 
+    def test_eid_dont_cross_relation_2(self):
+        repo._type_source_cache[999999] = ('Note', 'cards', 999999)
+        self.cards.dont_cross_relations.add('concerne')
+        try:
+            self._test('Any Y,S,YT,X WHERE Y concerne X, Y in_state S, X eid 999999, Y ref YT',
+                   [('OneFetchStep', [('Any Y,S,YT,999999 WHERE Y concerne 999999, Y in_state S, Y ref YT',
+                                       [{'Y': 'Affaire', 'YT': 'String', 'S': 'State'}])],
+                     None, None, [self.system], {}, [])],
+                   {'x': 999999})
+        finally:
+            self.cards.dont_cross_relations.remove('concerne')
+
 
     # external source w/ .cross_relations == ['multisource_crossed_rel'] ######