623 1. retrieve Any X,A,Y,B WHERE X login A, Y login B from system and ldap sources, store |
623 1. retrieve Any X,A,Y,B WHERE X login A, Y login B from system and ldap sources, store |
624 cartesian product of results into a temporary table |
624 cartesian product of results into a temporary table |
625 2. return the result of Any X,Y WHERE X login 'syt', Y login 'adim' |
625 2. return the result of Any X,Y WHERE X login 'syt', Y login 'adim' |
626 on the system source |
626 on the system source |
627 """ |
627 """ |
628 ueid = self.session.user.eid |
|
629 self._test('Any X,Y LIMIT 10 OFFSET 10 WHERE X login "syt", Y login "adim"', |
628 self._test('Any X,Y LIMIT 10 OFFSET 10 WHERE X login "syt", Y login "adim"', |
630 [('FetchStep', |
629 [('FetchStep', |
631 [('Any X WHERE X login "syt", X is CWUser', [{'X': 'CWUser'}])], |
630 [('Any X WHERE X login "syt", X is CWUser', [{'X': 'CWUser'}])], |
632 [self.ldap, self.system], None, {'X': 'table0.C0'}, []), |
631 [self.ldap, self.system], None, {'X': 'table0.C0'}, []), |
633 ('FetchStep', |
632 ('FetchStep', |
635 [self.ldap, self.system], None, {'Y': 'table1.C0'}, []), |
634 [self.ldap, self.system], None, {'Y': 'table1.C0'}, []), |
636 ('OneFetchStep', |
635 ('OneFetchStep', |
637 [('Any X,Y LIMIT 10 OFFSET 10 WHERE X is CWUser, Y is CWUser', [{'X': 'CWUser', 'Y': 'CWUser'}])], |
636 [('Any X,Y LIMIT 10 OFFSET 10 WHERE X is CWUser, Y is CWUser', [{'X': 'CWUser', 'Y': 'CWUser'}])], |
638 10, 10, [self.system], |
637 10, 10, [self.system], |
639 {'X': 'table0.C0', 'Y': 'table1.C0'}, []) |
638 {'X': 'table0.C0', 'Y': 'table1.C0'}, []) |
640 ], {'x': ueid}) |
639 ]) |
641 |
640 |
642 def test_complex_aggregat(self): |
641 def test_complex_aggregat(self): |
643 self._test('Any MAX(X)', |
642 self._test('Any MAX(X)', |
644 [('OneFetchStep', |
643 [('OneFetchStep', |
645 [('Any MAX(X)', X_ALL_SOLS)], |
644 [('Any MAX(X)', X_ALL_SOLS)], |
1415 'C': 'table1.C1', |
1414 'C': 'table1.C1', |
1416 'N': 'table0.C1'}, |
1415 'N': 'table0.C1'}, |
1417 [])], |
1416 [])], |
1418 {'E': self.session.user.eid}) |
1417 {'E': self.session.user.eid}) |
1419 |
1418 |
1420 def test_eid_dont_cross_relation(self): |
1419 def test_eid_dont_cross_relation_1(self): |
1421 repo._type_source_cache[999999] = ('Personne', 'system', 999999) |
1420 repo._type_source_cache[999999] = ('Personne', 'system', 999999) |
1422 self._test('Any Y,YT WHERE X eid %(x)s, X fiche Y, Y title YT', |
1421 self._test('Any Y,YT WHERE X eid %(x)s, X fiche Y, Y title YT', |
1423 [('OneFetchStep', [('Any Y,YT WHERE X eid 999999, X fiche Y, Y title YT', |
1422 [('OneFetchStep', [('Any Y,YT WHERE X eid 999999, X fiche Y, Y title YT', |
1424 [{'X': 'Personne', 'Y': 'Card', 'YT': 'String'}])], |
1423 [{'X': 'Personne', 'Y': 'Card', 'YT': 'String'}])], |
1425 None, None, [self.system], {}, [])], |
1424 None, None, [self.system], {}, [])], |
1426 {'x': 999999}) |
1425 {'x': 999999}) |
|
1426 |
|
1427 def test_eid_dont_cross_relation_2(self): |
|
1428 repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
|
1429 self.cards.dont_cross_relations.add('concerne') |
|
1430 try: |
|
1431 self._test('Any Y,S,YT,X WHERE Y concerne X, Y in_state S, X eid 999999, Y ref YT', |
|
1432 [('OneFetchStep', [('Any Y,S,YT,999999 WHERE Y concerne 999999, Y in_state S, Y ref YT', |
|
1433 [{'Y': 'Affaire', 'YT': 'String', 'S': 'State'}])], |
|
1434 None, None, [self.system], {}, [])], |
|
1435 {'x': 999999}) |
|
1436 finally: |
|
1437 self.cards.dont_cross_relations.remove('concerne') |
1427 |
1438 |
1428 |
1439 |
1429 # external source w/ .cross_relations == ['multisource_crossed_rel'] ###### |
1440 # external source w/ .cross_relations == ['multisource_crossed_rel'] ###### |
1430 |
1441 |
1431 def test_crossed_relation_eid_1_invariant(self): |
1442 def test_crossed_relation_eid_1_invariant(self): |