1362 self._test('Any Y,YT WHERE X eid %(x)s, X fiche Y, Y title YT', |
1364 self._test('Any Y,YT WHERE X eid %(x)s, X fiche Y, Y title YT', |
1363 [('OneFetchStep', [('Any Y,YT WHERE X eid 999999, X fiche Y, Y title YT', |
1365 [('OneFetchStep', [('Any Y,YT WHERE X eid 999999, X fiche Y, Y title YT', |
1364 [{'X': 'Personne', 'Y': 'Card', 'YT': 'String'}])], |
1366 [{'X': 'Personne', 'Y': 'Card', 'YT': 'String'}])], |
1365 None, None, [self.system], {}, [])], |
1367 None, None, [self.system], {}, [])], |
1366 {'x': 999999}) |
1368 {'x': 999999}) |
|
1369 |
|
1370 |
|
1371 # external source w/ .cross_relations == ['multisource_crossed_rel'] ###### |
|
1372 |
|
1373 def test_crossed_relation_eid_1_invariant(self): |
|
1374 repo._type_source_cache[999999] = ('Note', 'system', 999999) |
|
1375 ueid = self.session.user.eid |
|
1376 self._test('Any Y WHERE X eid %(x)s, X multisource_crossed_rel Y', |
|
1377 [('OneFetchStep', [('Any Y WHERE 999999 multisource_crossed_rel Y', [{u'Y': 'Note'}])], |
|
1378 None, None, [self.system], {}, []) |
|
1379 ], |
|
1380 {'x': 999999,}) |
|
1381 |
|
1382 def test_crossed_relation_eid_1_needattr(self): |
|
1383 repo._type_source_cache[999999] = ('Note', 'system', 999999) |
|
1384 ueid = self.session.user.eid |
|
1385 self._test('Any Y,T WHERE X eid %(x)s, X multisource_crossed_rel Y, Y type T', |
|
1386 [('FetchStep', [('Any Y,T WHERE Y type T, Y is Note', [{'T': 'String', 'Y': 'Note'}])], |
|
1387 [self.rql, self.system], None, |
|
1388 {'T': 'table0.C1', 'Y': 'table0.C0', 'Y.type': 'table0.C1'}, []), |
|
1389 ('OneFetchStep', [('Any Y,T WHERE 999999 multisource_crossed_rel Y, Y type T, Y is Note', |
|
1390 [{'T': 'String', 'Y': 'Note'}])], |
|
1391 None, None, [self.system], |
|
1392 {'T': 'table0.C1', 'Y': 'table0.C0', 'Y.type': 'table0.C1'}, []), |
|
1393 ], |
|
1394 {'x': 999999,}) |
|
1395 |
|
1396 def test_crossed_relation_eid_2_invariant(self): |
|
1397 repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
|
1398 ueid = self.session.user.eid |
|
1399 self._test('Any Y WHERE X eid %(x)s, X multisource_crossed_rel Y', |
|
1400 [('OneFetchStep', [('Any Y WHERE 999999 multisource_crossed_rel Y, Y is Note', [{'Y': 'Note'}])], |
|
1401 None, None, [self.rql, self.system], {}, []) |
|
1402 ], |
|
1403 {'x': 999999,}) |
|
1404 |
|
1405 def test_crossed_relation_eid_2_needattr(self): |
|
1406 repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
|
1407 ueid = self.session.user.eid |
|
1408 self._test('Any Y,T WHERE X eid %(x)s, X multisource_crossed_rel Y, Y type T', |
|
1409 [('FetchStep', [('Any Y,T WHERE Y type T, Y is Note', [{'T': 'String', 'Y': 'Note'}])], |
|
1410 [self.rql, self.system], None, |
|
1411 {'T': 'table0.C1', 'Y': 'table0.C0', 'Y.type': 'table0.C1'}, []), |
|
1412 ('OneFetchStep', [('Any Y,T WHERE 999999 multisource_crossed_rel Y, Y type T, Y is Note', |
|
1413 [{'T': 'String', 'Y': 'Note'}])], |
|
1414 None, None, [self.rql, self.system], |
|
1415 {'T': 'table0.C1', 'Y': 'table0.C0', 'Y.type': 'table0.C1'}, |
|
1416 []) |
|
1417 ], |
|
1418 {'x': 999999,}) |
|
1419 |
|
1420 def test_crossed_relation_eid_not_1(self): |
|
1421 repo._type_source_cache[999999] = ('Note', 'system', 999999) |
|
1422 ueid = self.session.user.eid |
|
1423 self._test('Any Y WHERE X eid %(x)s, NOT X multisource_crossed_rel Y', |
|
1424 [('FetchStep', [('Any Y WHERE Y is Note', [{'Y': 'Note'}])], |
|
1425 [self.rql, self.system], None, {'Y': 'table0.C0'}, []), |
|
1426 ('OneFetchStep', [('Any Y WHERE NOT 999999 multisource_crossed_rel Y, Y is Note', |
|
1427 [{'Y': 'Note'}])], |
|
1428 None, None, [self.system], |
|
1429 {'Y': 'table0.C0'}, [])], |
|
1430 {'x': 999999,}) |
|
1431 |
|
1432 # def test_crossed_relation_eid_not_2(self): |
|
1433 # repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
|
1434 # ueid = self.session.user.eid |
|
1435 # self._test('Any Y WHERE X eid %(x)s, NOT X multisource_crossed_rel Y', |
|
1436 # [], |
|
1437 # {'x': 999999,}) |
|
1438 |
|
1439 def test_crossed_relation_base(self): |
|
1440 repo._type_source_cache[999999] = ('Note', 'system', 999999) |
|
1441 ueid = self.session.user.eid |
|
1442 self._test('Any X,Y,T WHERE X multisource_crossed_rel Y, Y type T, X type T', |
|
1443 [('FetchStep', [('Any X,T WHERE X type T, X is Note', [{'T': 'String', 'X': 'Note'}])], |
|
1444 [self.rql, self.system], None, |
|
1445 {'T': 'table0.C1', 'X': 'table0.C0', 'X.type': 'table0.C1'}, []), |
|
1446 ('FetchStep', [('Any Y,T WHERE Y type T, Y is Note', [{'T': 'String', 'Y': 'Note'}])], |
|
1447 [self.rql, self.system], None, |
|
1448 {'T': 'table1.C1', 'Y': 'table1.C0', 'Y.type': 'table1.C1'}, []), |
|
1449 ('OneFetchStep', [('Any X,Y,T WHERE X multisource_crossed_rel Y, Y type T, X type T, X is Note, Y is Note', |
|
1450 [{'T': 'String', 'X': 'Note', 'Y': 'Note'}])], |
|
1451 None, None, [self.rql, self.system], |
|
1452 {'T': 'table1.C1', 'X': 'table0.C0', 'X.type': 'table0.C1', |
|
1453 'Y': 'table1.C0', 'Y.type': 'table1.C1'}, |
|
1454 [])], |
|
1455 {'x': 999999,}) |
1367 |
1456 |
1368 # edition queries tests ################################################### |
1457 # edition queries tests ################################################### |
1369 |
1458 |
1370 def test_insert_simplified_var_1(self): |
1459 def test_insert_simplified_var_1(self): |
1371 repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
1460 repo._type_source_cache[999999] = ('Note', 'cards', 999999) |