author | Adrien Di Mascio <Adrien.DiMascio@logilab.fr> |
Wed, 18 Feb 2009 19:19:57 +0100 | |
branch | tls-sprint |
changeset 823 | cb8ccbef8fa5 |
parent 393 | 45a675515427 |
child 1120 | 1c24cde4bf72 |
permissions | -rw-r--r-- |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1 |
from logilab.common.decorators import clear_cache |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2 |
from cubicweb.devtools import init_test_database |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
3 |
from cubicweb.devtools.repotest import BasePlannerTC, do_monkey_patch, undo_monkey_patch, test_plan |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
4 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
5 |
class _SetGenerator(object): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
6 |
"""singleton to easily create set using "s[0]" or "s[0,1,2]" for instance |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
7 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
8 |
def __getitem__(self, key): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
9 |
try: |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
10 |
it = iter(key) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
11 |
except TypeError: |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
12 |
it = (key,) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
13 |
return set(it) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
14 |
s = _SetGenerator() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
15 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
16 |
from cubicweb.schema import ERQLExpression |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
17 |
from cubicweb.server.sources import AbstractSource |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
18 |
from cubicweb.server.msplanner import MSPlanner, PartPlanInformation |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
19 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
20 |
class FakeUserROSource(AbstractSource): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
21 |
uri = 'zzz' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
22 |
support_entities = {'EUser': False} |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
23 |
support_relations = {} |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
24 |
def syntax_tree_search(self, *args, **kwargs): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
25 |
return [] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
26 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
27 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
28 |
class FakeCardSource(AbstractSource): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
29 |
uri = 'ccc' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
30 |
support_entities = {'Card': True, 'Note': True, 'State': True} |
393 | 31 |
support_relations = {'in_state': True, 'multisource_rel': True, 'multisource_inlined_rel': True, |
32 |
'multisource_crossed_rel': True} |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
33 |
dont_cross_relations = set(('fiche',)) |
393 | 34 |
cross_relations = set(('multisource_crossed_rel',)) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
35 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
36 |
def syntax_tree_search(self, *args, **kwargs): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
37 |
return [] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
38 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
39 |
X_ALL_SOLS = sorted([{'X': 'Affaire'}, {'X': 'Basket'}, {'X': 'Bookmark'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
40 |
{'X': 'Card'}, {'X': 'Comment'}, {'X': 'Division'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
41 |
{'X': 'ECache'}, {'X': 'EConstraint'}, {'X': 'EConstraintType'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
42 |
{'X': 'EEType'}, {'X': 'EFRDef'}, {'X': 'EGroup'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
43 |
{'X': 'ENFRDef'}, {'X': 'EPermission'}, {'X': 'EProperty'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
44 |
{'X': 'ERType'}, {'X': 'EUser'}, {'X': 'Email'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
45 |
{'X': 'EmailAddress'}, {'X': 'EmailPart'}, {'X': 'EmailThread'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
46 |
{'X': 'File'}, {'X': 'Folder'}, {'X': 'Image'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
47 |
{'X': 'Note'}, {'X': 'Personne'}, {'X': 'RQLExpression'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
48 |
{'X': 'Societe'}, {'X': 'State'}, {'X': 'SubDivision'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
49 |
{'X': 'Tag'}, {'X': 'TrInfo'}, {'X': 'Transition'}]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
50 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
51 |
# keep cnx so it's not garbage collected and the associated session is closed |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
52 |
repo, cnx = init_test_database('sqlite') |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
53 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
54 |
class BaseMSPlannerTC(BasePlannerTC): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
55 |
"""test planner related feature on a 3-sources repository: |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
56 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
57 |
* system source supporting everything |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
58 |
* ldap source supporting EUser |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
59 |
* rql source supporting Card |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
60 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
61 |
repo = repo |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
62 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
63 |
def setUp(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
64 |
#_QuerierTC.setUp(self) |
341
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
65 |
clear_cache(repo, 'rel_type_sources') |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
66 |
self.o = repo.querier |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
67 |
self.session = repo._sessions.values()[0] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
68 |
self.pool = self.session.set_pool() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
69 |
self.schema = self.o.schema |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
70 |
# hijack Affaire security |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
71 |
affreadperms = list(self.schema['Affaire']._groups['read']) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
72 |
self.prevrqlexpr_affaire = affreadperms[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
73 |
# add access to type attribute so S can't be invariant |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
74 |
affreadperms[-1] = ERQLExpression('X concerne S?, S owned_by U, S type "X"') |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
75 |
self.schema['Affaire']._groups['read'] = tuple(affreadperms) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
76 |
# hijack EUser security |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
77 |
userreadperms = list(self.schema['EUser']._groups['read']) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
78 |
self.prevrqlexpr_user = userreadperms[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
79 |
userreadperms[-1] = ERQLExpression('X owned_by U') |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
80 |
self.schema['EUser']._groups['read'] = tuple(userreadperms) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
81 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
82 |
self.sources = self.o._repo.sources |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
83 |
self.system = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
84 |
self.sources.append(FakeUserROSource(self.o._repo, self.o.schema, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
85 |
{'uri': 'ldapuser'})) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
86 |
repo.sources_by_uri['ldapuser'] = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
87 |
self.ldap = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
88 |
self.sources.append(FakeCardSource(self.o._repo, self.o.schema, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
89 |
{'uri': 'cards'})) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
90 |
repo.sources_by_uri['cards'] = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
91 |
self.rql = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
92 |
do_monkey_patch() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
93 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
94 |
def tearDown(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
95 |
undo_monkey_patch() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
96 |
del self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
97 |
del self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
98 |
del repo.sources_by_uri['ldapuser'] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
99 |
del repo.sources_by_uri['cards'] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
100 |
# restore hijacked security |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
101 |
self.restore_orig_affaire_security() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
102 |
self.restore_orig_euser_security() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
103 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
104 |
def restore_orig_affaire_security(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
105 |
affreadperms = list(self.schema['Affaire']._groups['read']) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
106 |
affreadperms[-1] = self.prevrqlexpr_affaire |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
107 |
self.schema['Affaire']._groups['read'] = tuple(affreadperms) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
108 |
clear_cache(self.schema['Affaire'], 'ERSchema_get_rqlexprs') |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
109 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
110 |
def restore_orig_euser_security(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
111 |
userreadperms = list(self.schema['EUser']._groups['read']) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
112 |
userreadperms[-1] = self.prevrqlexpr_user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
113 |
self.schema['EUser']._groups['read'] = tuple(userreadperms) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
114 |
clear_cache(self.schema['EUser'], 'ERSchema_get_rqlexprs') |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
115 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
116 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
117 |
class PartPlanInformationTC(BaseMSPlannerTC): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
118 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
119 |
def _test(self, rql, *args): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
120 |
if len(args) == 3: |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
121 |
kwargs, sourcesvars, needsplit = args |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
122 |
else: |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
123 |
sourcesvars, needsplit = args |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
124 |
kwargs = None |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
125 |
plan = self._prepare_plan(rql, kwargs) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
126 |
union = plan.rqlst |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
127 |
plan.preprocess(union) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
128 |
ppi = PartPlanInformation(plan, union.children[0]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
129 |
for sourcevars in ppi._sourcesvars.itervalues(): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
130 |
for var in sourcevars.keys(): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
131 |
solindices = sourcevars.pop(var) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
132 |
sourcevars[var._ms_table_key()] = solindices |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
133 |
self.assertEquals(ppi._sourcesvars, sourcesvars) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
134 |
self.assertEquals(ppi.needsplit, needsplit) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
135 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
136 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
137 |
def test_simple_system_only(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
138 |
"""retrieve entities only supported by the system source""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
139 |
self._test('EGroup X', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
140 |
{self.system: {'X': s[0]}}, False) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
141 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
142 |
def test_simple_system_ldap(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
143 |
"""retrieve EUser X from both sources and return concatenation of results |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
144 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
145 |
self._test('EUser X', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
146 |
{self.system: {'X': s[0]}, self.ldap: {'X': s[0]}}, False) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
147 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
148 |
def test_simple_system_rql(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
149 |
"""retrieve Card X from both sources and return concatenation of results |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
150 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
151 |
self._test('Any X, XT WHERE X is Card, X title XT', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
152 |
{self.system: {'X': s[0]}, self.rql: {'X': s[0]}}, False) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
153 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
154 |
def test_simple_eid_specified(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
155 |
"""retrieve EUser X from system source (eid is specified, can locate the entity) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
156 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
157 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
158 |
self._test('Any X,L WHERE X eid %(x)s, X login L', {'x': ueid}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
159 |
{self.system: {'X': s[0]}}, False) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
160 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
161 |
def test_simple_eid_invariant(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
162 |
"""retrieve EUser X from system source (eid is specified, can locate the entity) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
163 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
164 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
165 |
self._test('Any X WHERE X eid %(x)s', {'x': ueid}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
166 |
{}, False) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
167 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
168 |
def test_simple_invariant(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
169 |
"""retrieve EUser X from system source only (X is invariant and in_group not supported by ldap source) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
170 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
171 |
self._test('Any X WHERE X is EUser, X in_group G, G name "users"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
172 |
{self.system: {'X': s[0], 'G': s[0], 'in_group': s[0]}}, False) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
173 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
174 |
def test_security_has_text(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
175 |
"""retrieve EUser X from system source only (has_text not supported by ldap source) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
176 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
177 |
# specify EUser instead of any since the way this test is written we aren't well dealing |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
178 |
# with ambigous query (eg only considering the first solution) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
179 |
self._test('EUser X WHERE X has_text "bla"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
180 |
{self.system: {'X': s[0]}}, False) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
181 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
182 |
def test_complex_base(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
183 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
184 |
1. retrieve Any X, L WHERE X is EUser, X login L from system and ldap sources, store |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
185 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
186 |
2. return the result of Any X, L WHERE X is TMP, X login L, X in_group G, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
187 |
G name 'users' on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
188 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
189 |
self._test('Any X,L WHERE X is EUser, X in_group G, X login L, G name "users"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
190 |
{self.system: {'X': s[0], 'G': s[0], 'in_group': s[0]}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
191 |
self.ldap : {'X': s[0]}}, True) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
192 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
193 |
def test_complex_invariant_ordered(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
194 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
195 |
1. retrieve Any X,AA WHERE X modification_date AA from system and ldap sources, store |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
196 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
197 |
2. return the result of Any X,AA ORDERBY AA WHERE %s owned_by X, X modification_date AA |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
198 |
on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
199 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
200 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
201 |
self._test('Any X,AA ORDERBY AA WHERE E eid %(x)s, E owned_by X, X modification_date AA', {'x': ueid}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
202 |
{self.system: {'x': s[0], 'X': s[0], 'owned_by': s[0]}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
203 |
self.ldap : {'X': s[0]}}, True) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
204 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
205 |
def test_complex_invariant(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
206 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
207 |
1. retrieve Any X,L,AA WHERE X login L, X modification_date AA from system and ldap sources, store |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
208 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
209 |
2. return the result of Any X,L,AA WHERE %s owned_by X, X login L, X modification_date AA |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
210 |
on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
211 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
212 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
213 |
self._test('Any X,L,AA WHERE E eid %(x)s, E owned_by X, X login L, X modification_date AA', {'x': ueid}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
214 |
{self.system: {'x': s[0], 'X': s[0], 'owned_by': s[0]}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
215 |
self.ldap : {'X': s[0]}}, True) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
216 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
217 |
def test_complex_ambigous(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
218 |
"""retrieve EUser X from system and ldap sources, Person X from system source only |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
219 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
220 |
self._test('Any X,F WHERE X firstname F', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
221 |
{self.system: {'X': s[0, 1]}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
222 |
self.ldap: {'X': s[0]}}, True) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
223 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
224 |
def test_complex_multiple(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
225 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
226 |
1. retrieve Any X,A,Y,B WHERE X login A, Y login B from system and ldap sources, store |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
227 |
cartesian product of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
228 |
2. return the result of Any X,Y WHERE X login 'syt', Y login 'adim' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
229 |
on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
230 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
231 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
232 |
self._test('Any X,Y WHERE X login "syt", Y login "adim"', {'x': ueid}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
233 |
{self.system: {'Y': s[0], 'X': s[0]}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
234 |
self.ldap: {'Y': s[0], 'X': s[0]}}, True) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
235 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
236 |
def test_complex_aggregat(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
237 |
solindexes = set(range(len([e for e in self.schema.entities() if not e.is_final()]))) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
238 |
self._test('Any MAX(X)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
239 |
{self.system: {'X': solindexes}}, False) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
240 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
241 |
def test_complex_optional(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
242 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
243 |
self._test('Any U WHERE WF wf_info_for X, X eid %(x)s, WF owned_by U?, WF from_state FS', {'x': ueid}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
244 |
{self.system: {'WF': s[0], 'FS': s[0], 'U': s[0], 'from_state': s[0], 'owned_by': s[0], 'wf_info_for': s[0]}}, False) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
245 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
246 |
def test_exists4(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
247 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
248 |
State S could come from both rql source and system source, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
249 |
but since X cannot come from the rql source, the solution |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
250 |
{self.rql : 'S'} must be removed |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
251 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
252 |
self._test('Any G,L WHERE X in_group G, X login L, G name "managers", ' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
253 |
'EXISTS(X copain T, T login L, T login in ("comme", "cochon")) OR ' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
254 |
'EXISTS(X in_state S, S name "pascontent", NOT X copain T2, T2 login "billy")', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
255 |
{self.system: {'X': s[0], 'S': s[0], 'T2': s[0], 'T': s[0], 'G': s[0], 'copain': s[0], 'in_group': s[0]}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
256 |
self.ldap: {'X': s[0], 'T2': s[0], 'T': s[0]}}, True) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
257 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
258 |
def test_relation_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
259 |
self._test('Any X, S WHERE X in_state S', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
260 |
{self.system: {'X': s[0, 1, 2], 'S': s[0, 1, 2]}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
261 |
self.rql: {'X': s[2], 'S': s[2]}}, True) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
262 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
263 |
def test_relation_restriction_ambigous_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
264 |
self._test('Any X,T WHERE X in_state S, S name "pending", T tags X', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
265 |
{self.system: {'X': s[0, 1, 2], 'S': s[0, 1, 2], 'T': s[0, 1, 2], 'tags': s[0, 1, 2]}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
266 |
self.rql: {'X': s[2], 'S': s[2]}}, True) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
267 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
268 |
def test_simplified_var(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
269 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
270 |
self._test('Any U WHERE U in_group G, (G name IN ("managers", "logilab") OR (X require_permission P?, P name "bla", P require_group G)), X eid %(x)s, U eid %(u)s', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
271 |
{'x': 999999, 'u': self.session.user.eid}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
272 |
{self.system: {'P': s[0], 'G': s[0], 'X': s[0], 'require_permission': s[0], 'in_group': s[0], 'P': s[0], 'require_group': s[0]}}, False) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
273 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
274 |
def test_delete_relation1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
275 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
276 |
self._test('Any X, Y WHERE X created_by Y, X eid %(x)s, NOT Y eid %(y)s', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
277 |
{'x': ueid, 'y': ueid}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
278 |
{self.system: {'Y': s[0], 'created_by': s[0]}}, False) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
279 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
280 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
281 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
282 |
class MSPlannerTC(BaseMSPlannerTC): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
283 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
284 |
def setUp(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
285 |
BaseMSPlannerTC.setUp(self) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
286 |
self.planner = MSPlanner(self.o.schema, self.o._rqlhelper) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
287 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
288 |
_test = test_plan |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
289 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
290 |
def test_simple_system_only(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
291 |
"""retrieve entities only supported by the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
292 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
293 |
self._test('EGroup X', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
294 |
[('OneFetchStep', [('Any X WHERE X is EGroup', [{'X': 'EGroup'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
295 |
None, None, [self.system], {}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
296 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
297 |
def test_simple_system_only_limit(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
298 |
"""retrieve entities only supported by the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
299 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
300 |
self._test('EGroup X LIMIT 10', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
301 |
[('OneFetchStep', [('Any X LIMIT 10 WHERE X is EGroup', [{'X': 'EGroup'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
302 |
10, None, [self.system], {}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
303 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
304 |
def test_simple_system_only_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
305 |
"""retrieve entities only supported by the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
306 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
307 |
self._test('EGroup X LIMIT 10 OFFSET 10', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
308 |
[('OneFetchStep', [('Any X LIMIT 10 OFFSET 10 WHERE X is EGroup', [{'X': 'EGroup'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
309 |
10, 10, [self.system], {}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
310 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
311 |
def test_simple_system_ldap(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
312 |
"""retrieve EUser X from both sources and return concatenation of results |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
313 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
314 |
self._test('EUser X', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
315 |
[('OneFetchStep', [('Any X WHERE X is EUser', [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
316 |
None, None, [self.ldap, self.system], {}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
317 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
318 |
def test_simple_system_ldap_limit(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
319 |
"""retrieve EUser X from both sources and return concatenation of results |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
320 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
321 |
self._test('EUser X LIMIT 10', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
322 |
[('OneFetchStep', [('Any X LIMIT 10 WHERE X is EUser', [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
323 |
10, None, [self.ldap, self.system], {}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
324 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
325 |
def test_simple_system_ldap_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
326 |
"""retrieve EUser X from both sources and return concatenation of results |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
327 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
328 |
self._test('EUser X LIMIT 10 OFFSET 10', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
329 |
[('OneFetchStep', [('Any X LIMIT 10 OFFSET 10 WHERE X is EUser', [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
330 |
10, 10, [self.ldap, self.system], {}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
331 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
332 |
def test_simple_system_ldap_ordered_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
333 |
"""retrieve EUser X from both sources and return concatenation of results |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
334 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
335 |
self._test('EUser X ORDERBY X LIMIT 10 OFFSET 10', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
336 |
[('AggrStep', 'Any X ORDERBY X', 10, 10, 'table0', None, [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
337 |
('FetchStep', [('Any X WHERE X is EUser', [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
338 |
[self.ldap, self.system], {}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
339 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
340 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
341 |
def test_simple_system_ldap_aggregat(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
342 |
"""retrieve EUser X from both sources and return concatenation of results |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
343 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
344 |
# COUNT(X) is kept in sub-step and transformed into SUM(X) in the AggrStep |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
345 |
self._test('Any COUNT(X) WHERE X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
346 |
[('AggrStep', 'Any COUNT(X)', None, None, 'table0', None, [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
347 |
('FetchStep', [('Any COUNT(X) WHERE X is EUser', [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
348 |
[self.ldap, self.system], {}, {'COUNT(X)': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
349 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
350 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
351 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
352 |
def test_simple_system_rql(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
353 |
"""retrieve Card X from both sources and return concatenation of results |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
354 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
355 |
self._test('Any X, XT WHERE X is Card, X title XT', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
356 |
[('OneFetchStep', [('Any X,XT WHERE X is Card, X title XT', [{'X': 'Card', 'XT': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
357 |
None, None, [self.rql, self.system], {}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
358 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
359 |
def test_simple_eid_specified(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
360 |
"""retrieve EUser X from system source (eid is specified, can locate the entity) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
361 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
362 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
363 |
self._test('Any X,L WHERE X eid %(x)s, X login L', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
364 |
[('OneFetchStep', [('Any X,L WHERE X eid %s, X login L'%ueid, [{'X': 'EUser', 'L': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
365 |
None, None, [self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
366 |
{'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
367 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
368 |
def test_simple_eid_invariant(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
369 |
"""retrieve EUser X from system source (eid is specified, can locate the entity) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
370 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
371 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
372 |
self._test('Any X WHERE X eid %(x)s', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
373 |
[('OneFetchStep', [('Any %s'%ueid, [{}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
374 |
None, None, [self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
375 |
{'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
376 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
377 |
def test_simple_invariant(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
378 |
"""retrieve EUser X from system source only (X is invariant and in_group not supported by ldap source) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
379 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
380 |
self._test('Any X WHERE X is EUser, X in_group G, G name "users"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
381 |
[('OneFetchStep', [('Any X WHERE X is EUser, X in_group G, G name "users"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
382 |
[{'X': 'EUser', 'G': 'EGroup'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
383 |
None, None, [self.system], {}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
384 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
385 |
def test_complex_base(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
386 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
387 |
1. retrieve Any X, L WHERE X is EUser, X login L from system and ldap sources, store |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
388 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
389 |
2. return the result of Any X, L WHERE X is TMP, X login LX in_group G, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
390 |
G name 'users' on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
391 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
392 |
self._test('Any X,L WHERE X is EUser, X in_group G, X login L, G name "users"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
393 |
[('FetchStep', [('Any X,L WHERE X login L, X is EUser', [{'X': 'EUser', 'L': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
394 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
395 |
{'X': 'table0.C0', 'X.login': 'table0.C1', 'L': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
396 |
('OneFetchStep', [('Any X,L WHERE X in_group G, X login L, G name "users", G is EGroup, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
397 |
[{'X': 'EUser', 'L': 'String', 'G': 'EGroup'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
398 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
399 |
{'X': 'table0.C0', 'X.login': 'table0.C1', 'L': 'table0.C1'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
400 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
401 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
402 |
def test_complex_base_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
403 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
404 |
1. retrieve Any X, L WHERE X is EUser, X login L from system and ldap sources, store |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
405 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
406 |
2. return the result of Any X, L WHERE X is TMP, X login LX in_group G, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
407 |
G name 'users' on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
408 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
409 |
self._test('Any X,L LIMIT 10 OFFSET 10 WHERE X is EUser, X in_group G, X login L, G name "users"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
410 |
[('FetchStep', [('Any X,L WHERE X login L, X is EUser', [{'X': 'EUser', 'L': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
411 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
412 |
{'X': 'table0.C0', 'X.login': 'table0.C1', 'L': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
413 |
('OneFetchStep', [('Any X,L LIMIT 10 OFFSET 10 WHERE X in_group G, X login L, G name "users", G is EGroup, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
414 |
[{'X': 'EUser', 'L': 'String', 'G': 'EGroup'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
415 |
10, 10, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
416 |
[self.system], {'X': 'table0.C0', 'X.login': 'table0.C1', 'L': 'table0.C1'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
417 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
418 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
419 |
def test_complex_ordered(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
420 |
self._test('Any L ORDERBY L WHERE X login L', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
421 |
[('AggrStep', 'Any L ORDERBY L', None, None, 'table0', None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
422 |
[('FetchStep', [('Any L WHERE X login L, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
423 |
[{'X': 'EUser', 'L': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
424 |
[self.ldap, self.system], {}, {'X.login': 'table0.C0', 'L': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
425 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
426 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
427 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
428 |
def test_complex_ordered_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
429 |
self._test('Any L ORDERBY L LIMIT 10 OFFSET 10 WHERE X login L', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
430 |
[('AggrStep', 'Any L ORDERBY L', 10, 10, 'table0', None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
431 |
[('FetchStep', [('Any L WHERE X login L, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
432 |
[{'X': 'EUser', 'L': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
433 |
[self.ldap, self.system], {}, {'X.login': 'table0.C0', 'L': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
434 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
435 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
436 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
437 |
def test_complex_invariant_ordered(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
438 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
439 |
1. retrieve Any X,AA WHERE X modification_date AA from system and ldap sources, store |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
440 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
441 |
2. return the result of Any X,AA ORDERBY AA WHERE %s owned_by X, X modification_date AA |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
442 |
on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
443 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
444 |
herrr, this is what is expected by the XXX :(, not the actual result (which is correct anyway) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
445 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
446 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
447 |
self._test('Any X,AA ORDERBY AA WHERE E eid %(x)s, E owned_by X, X modification_date AA', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
448 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
449 |
[('Any X,AA WHERE X modification_date AA, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
450 |
[{'AA': 'Datetime', 'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
451 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
452 |
{'AA': 'table0.C1', 'X': 'table0.C0', 'X.modification_date': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
453 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
454 |
[('Any X,AA ORDERBY AA WHERE 5 owned_by X, X modification_date AA, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
455 |
[{'AA': 'Datetime', 'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
456 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
457 |
{'AA': 'table0.C1', 'X': 'table0.C0', 'X.modification_date': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
458 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
459 |
{'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
460 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
461 |
def test_complex_invariant(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
462 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
463 |
1. retrieve Any X,L,AA WHERE X login L, X modification_date AA from system and ldap sources, store |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
464 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
465 |
2. return the result of Any X,L,AA WHERE %s owned_by X, X login L, X modification_date AA |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
466 |
on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
467 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
468 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
469 |
self._test('Any X,L,AA WHERE E eid %(x)s, E owned_by X, X login L, X modification_date AA', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
470 |
[('FetchStep', [('Any X,L,AA WHERE X login L, X modification_date AA, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
471 |
[{'AA': 'Datetime', 'X': 'EUser', 'L': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
472 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
473 |
{'AA': 'table0.C2', 'X': 'table0.C0', 'X.login': 'table0.C1', 'X.modification_date': 'table0.C2', 'L': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
474 |
('OneFetchStep', [('Any X,L,AA WHERE %s owned_by X, X login L, X modification_date AA, X is EUser'%ueid, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
475 |
[{'AA': 'Datetime', 'X': 'EUser', 'L': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
476 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
477 |
{'AA': 'table0.C2', 'X': 'table0.C0', 'X.login': 'table0.C1', 'X.modification_date': 'table0.C2', 'L': 'table0.C1'}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
478 |
{'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
479 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
480 |
def test_complex_ambigous(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
481 |
"""retrieve EUser X from system and ldap sources, Person X from system source only |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
482 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
483 |
self._test('Any X,F WHERE X firstname F', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
484 |
[('UnionStep', None, None, [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
485 |
('OneFetchStep', [('Any X,F WHERE X firstname F, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
486 |
[{'X': 'EUser', 'F': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
487 |
None, None, [self.ldap, self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
488 |
('OneFetchStep', [('Any X,F WHERE X firstname F, X is Personne', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
489 |
[{'X': 'Personne', 'F': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
490 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
491 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
492 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
493 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
494 |
def test_complex_ambigous_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
495 |
"""retrieve EUser X from system and ldap sources, Person X from system source only |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
496 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
497 |
self._test('Any X,F LIMIT 10 OFFSET 10 WHERE X firstname F', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
498 |
[('UnionStep', 10, 10, [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
499 |
('OneFetchStep', [('Any X,F WHERE X firstname F, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
500 |
[{'X': 'EUser', 'F': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
501 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
502 |
[self.ldap, self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
503 |
('OneFetchStep', [('Any X,F WHERE X firstname F, X is Personne', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
504 |
[{'X': 'Personne', 'F': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
505 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
506 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
507 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
508 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
509 |
def test_complex_ambigous_ordered(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
510 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
511 |
1. retrieve EUser X from system and ldap sources, Person X from system source only, store |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
512 |
each result in the same temp table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
513 |
2. return content of the table sorted |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
514 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
515 |
self._test('Any X,F ORDERBY F WHERE X firstname F', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
516 |
[('AggrStep', 'Any X,F ORDERBY F', None, None, 'table0', None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
517 |
[('FetchStep', [('Any X,F WHERE X firstname F, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
518 |
[{'X': 'EUser', 'F': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
519 |
[self.ldap, self.system], {}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
520 |
{'X': 'table0.C0', 'X.firstname': 'table0.C1', 'F': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
521 |
('FetchStep', [('Any X,F WHERE X firstname F, X is Personne', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
522 |
[{'X': 'Personne', 'F': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
523 |
[self.system], {}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
524 |
{'X': 'table0.C0', 'X.firstname': 'table0.C1', 'F': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
525 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
526 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
527 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
528 |
def test_complex_multiple(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
529 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
530 |
1. retrieve Any X,A,Y,B WHERE X login A, Y login B from system and ldap sources, store |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
531 |
cartesian product of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
532 |
2. return the result of Any X,Y WHERE X login 'syt', Y login 'adim' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
533 |
on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
534 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
535 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
536 |
self._test('Any X,Y WHERE X login "syt", Y login "adim"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
537 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
538 |
[('Any X WHERE X login "syt", X is EUser', [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
539 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
540 |
{'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
541 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
542 |
[('Any Y WHERE Y login "adim", Y is EUser', [{'Y': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
543 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
544 |
{'Y': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
545 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
546 |
[('Any X,Y WHERE X is EUser, Y is EUser', [{'X': 'EUser', 'Y': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
547 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
548 |
{'X': 'table0.C0', 'Y': 'table1.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
549 |
], {'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
550 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
551 |
def test_complex_multiple_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
552 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
553 |
1. retrieve Any X,A,Y,B WHERE X login A, Y login B from system and ldap sources, store |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
554 |
cartesian product of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
555 |
2. return the result of Any X,Y WHERE X login 'syt', Y login 'adim' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
556 |
on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
557 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
558 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
559 |
self._test('Any X,Y LIMIT 10 OFFSET 10 WHERE X login "syt", Y login "adim"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
560 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
561 |
[('Any X WHERE X login "syt", X is EUser', [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
562 |
[self.ldap, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
563 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
564 |
[('Any Y WHERE Y login "adim", Y is EUser', [{'Y': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
565 |
[self.ldap, self.system], None, {'Y': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
566 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
567 |
[('Any X,Y LIMIT 10 OFFSET 10 WHERE X is EUser, Y is EUser', [{'X': 'EUser', 'Y': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
568 |
10, 10, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
569 |
{'X': 'table0.C0', 'Y': 'table1.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
570 |
], {'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
571 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
572 |
def test_complex_aggregat(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
573 |
self._test('Any MAX(X)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
574 |
[('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
575 |
[('Any MAX(X)', X_ALL_SOLS)], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
576 |
None, None, [self.system], {}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
577 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
578 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
579 |
def test_complex_typed_aggregat(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
580 |
self._test('Any MAX(X) WHERE X is Card', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
581 |
[('AggrStep', 'Any MAX(X)', None, None, 'table0', None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
582 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
583 |
[('Any MAX(X) WHERE X is Card', [{'X': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
584 |
[self.rql, self.system], {}, {'MAX(X)': 'table0.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
585 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
586 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
587 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
588 |
def test_complex_greater_eid(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
589 |
self._test('Any X WHERE X eid > 12', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
590 |
[('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
591 |
[('Any X WHERE X eid > 12', X_ALL_SOLS)], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
592 |
None, None, [self.system], {}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
593 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
594 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
595 |
def test_complex_greater_typed_eid(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
596 |
self._test('Any X WHERE X eid > 12, X is Card', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
597 |
[('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
598 |
[('Any X WHERE X eid > 12, X is Card', [{'X': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
599 |
None, None, [self.system], {}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
600 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
601 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
602 |
def test_complex_optional(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
603 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
604 |
self._test('Any U WHERE WF wf_info_for X, X eid %(x)s, WF owned_by U?, WF from_state FS', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
605 |
[('OneFetchStep', [('Any U WHERE WF wf_info_for 5, WF owned_by U?, WF from_state FS', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
606 |
[{'WF': 'TrInfo', 'FS': 'State', 'U': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
607 |
None, None, [self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
608 |
{'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
609 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
610 |
def test_complex_optional(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
611 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
612 |
self._test('Any U WHERE WF wf_info_for X, X eid %(x)s, WF owned_by U?, WF from_state FS', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
613 |
[('OneFetchStep', [('Any U WHERE WF wf_info_for 5, WF owned_by U?, WF from_state FS', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
614 |
[{'WF': 'TrInfo', 'FS': 'State', 'U': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
615 |
None, None, [self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
616 |
{'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
617 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
618 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
619 |
def test_3sources_ambigous(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
620 |
self._test('Any X,T WHERE X owned_by U, U login "syt", X title T', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
621 |
[('FetchStep', [('Any X,T WHERE X title T, X is Card', [{'X': 'Card', 'T': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
622 |
[self.rql, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
623 |
{'T': 'table0.C1', 'X': 'table0.C0', 'X.title': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
624 |
('FetchStep', [('Any U WHERE U login "syt", U is EUser', [{'U': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
625 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
626 |
{'U': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
627 |
('UnionStep', None, None, [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
628 |
('OneFetchStep', [('Any X,T WHERE X owned_by U, X title T, U is EUser, X is IN(Bookmark, EmailThread)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
629 |
[{'T': 'String', 'U': 'EUser', 'X': 'Bookmark'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
630 |
{'T': 'String', 'U': 'EUser', 'X': 'EmailThread'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
631 |
None, None, [self.system], {'U': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
632 |
('OneFetchStep', [('Any X,T WHERE X owned_by U, X title T, U is EUser, X is Card', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
633 |
[{'X': 'Card', 'U': 'EUser', 'T': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
634 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
635 |
{'X': 'table0.C0', 'X.title': 'table0.C1', 'T': 'table0.C1', 'U': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
636 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
637 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
638 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
639 |
def test_restricted_max(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
640 |
# dumb query to emulate the one generated by svnfile.entities.rql_revision_content |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
641 |
self._test('Any V, MAX(VR) WHERE V is Card, V creation_date VR, ' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
642 |
'(V creation_date TODAY OR (V creation_date < TODAY AND NOT EXISTS(' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
643 |
'X is Card, X creation_date < TODAY, X creation_date >= VR)))', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
644 |
[('FetchStep', [('Any VR WHERE X creation_date < TODAY, X creation_date >= VR, X is Card', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
645 |
[{'X': 'Card', 'VR': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
646 |
[self.rql, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
647 |
{'VR': 'table0.C0', 'X.creation_date': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
648 |
('FetchStep', [('Any V,VR WHERE V creation_date VR, V is Card', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
649 |
[{'VR': 'Datetime', 'V': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
650 |
[self.rql, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
651 |
{'VR': 'table1.C1', 'V': 'table1.C0', 'V.creation_date': 'table1.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
652 |
('OneFetchStep', [('Any V,MAX(VR) WHERE V creation_date VR, (V creation_date TODAY) OR (V creation_date < TODAY, NOT EXISTS(X creation_date >= VR, X is Card)), V is Card', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
653 |
[{'X': 'Card', 'VR': 'Datetime', 'V': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
654 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
655 |
{'VR': 'table1.C1', 'V': 'table1.C0', 'V.creation_date': 'table1.C1', 'X.creation_date': 'table0.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
656 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
657 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
658 |
def test_outer_supported_rel1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
659 |
# both system and rql support all variables, can be |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
660 |
self._test('Any X, R WHERE X is Note, X in_state S, X type R, ' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
661 |
'NOT EXISTS(Y is Note, Y in_state S, Y type R, X identity Y)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
662 |
[('OneFetchStep', [('Any X,R WHERE X is Note, X in_state S, X type R, NOT EXISTS(Y is Note, Y in_state S, Y type R, X identity Y), S is State', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
663 |
[{'Y': 'Note', 'X': 'Note', 'S': 'State', 'R': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
664 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
665 |
[self.rql, self.system], {}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
666 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
667 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
668 |
def test_not_identity(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
669 |
# both system and rql support all variables, can be |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
670 |
self._test('Any X WHERE NOT X identity U, U eid %s' % self.session.user.eid, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
671 |
[('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
672 |
[('Any X WHERE NOT X identity 5, X is EUser', [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
673 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
674 |
[self.ldap, self.system], {}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
675 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
676 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
677 |
def test_outer_supported_rel2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
678 |
self._test('Any X, MAX(R) GROUPBY X WHERE X in_state S, X login R, ' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
679 |
'NOT EXISTS(Y is Note, Y in_state S, Y type R)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
680 |
[('FetchStep', [('Any A,R WHERE Y in_state A, Y type R, A is State, Y is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
681 |
[{'Y': 'Note', 'A': 'State', 'R': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
682 |
[self.rql, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
683 |
{'A': 'table0.C0', 'R': 'table0.C1', 'Y.type': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
684 |
('FetchStep', [('Any X,R WHERE X login R, X is EUser', [{'X': 'EUser', 'R': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
685 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
686 |
{'X': 'table1.C0', 'X.login': 'table1.C1', 'R': 'table1.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
687 |
('OneFetchStep', [('Any X,MAX(R) GROUPBY X WHERE X in_state S, X login R, NOT EXISTS(Y type R, S identity A, A is State, Y is Note), S is State, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
688 |
[{'Y': 'Note', 'X': 'EUser', 'S': 'State', 'R': 'String', 'A': 'State'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
689 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
690 |
{'A': 'table0.C0', 'X': 'table1.C0', 'X.login': 'table1.C1', 'R': 'table1.C1', 'Y.type': 'table0.C1'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
691 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
692 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
693 |
def test_security_has_text(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
694 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
695 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
696 |
self._test('Any X WHERE X has_text "bla"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
697 |
[('FetchStep', [('Any E WHERE E type "X", E is Note', [{'E': 'Note'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
698 |
[self.rql, self.system], None, {'E': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
699 |
('UnionStep', None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
700 |
[('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
701 |
[(u'Any X WHERE X has_text "bla", (EXISTS(X owned_by 5)) OR ((((EXISTS(D concerne C?, C owned_by 5, C type "X", X identity D, C is Division, D is Affaire)) OR (EXISTS(H concerne G?, G owned_by 5, G type "X", X identity H, G is SubDivision, H is Affaire))) OR (EXISTS(I concerne F?, F owned_by 5, F type "X", X identity I, F is Societe, I is Affaire))) OR (EXISTS(J concerne E?, E owned_by 5, X identity J, E is Note, J is Affaire))), X is Affaire', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
702 |
[{'C': 'Division', 'E': 'Note', 'D': 'Affaire', 'G': 'SubDivision', 'F': 'Societe', 'I': 'Affaire', 'H': 'Affaire', 'J': 'Affaire', 'X': 'Affaire'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
703 |
None, None, [self.system], {'E': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
704 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
705 |
[('Any X WHERE X has_text "bla", EXISTS(X owned_by 5), X is Basket', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
706 |
[{'X': 'Basket'}]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
707 |
('Any X WHERE X has_text "bla", EXISTS(X owned_by 5), X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
708 |
[{'X': 'EUser'}]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
709 |
('Any X WHERE X has_text "bla", X is IN(Card, Comment, Division, Email, EmailThread, File, Folder, Image, Note, Personne, Societe, State, SubDivision, Tag, Transition)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
710 |
[{'X': 'Card'}, {'X': 'Comment'}, {'X': 'Division'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
711 |
{'X': 'Email'}, {'X': 'EmailThread'}, {'X': 'File'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
712 |
{'X': 'Folder'}, {'X': 'Image'}, {'X': 'Note'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
713 |
{'X': 'Personne'}, {'X': 'Societe'}, {'X': 'State'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
714 |
{'X': 'SubDivision'}, {'X': 'Tag'}, {'X': 'Transition'}]),], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
715 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
716 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
717 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
718 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
719 |
def test_security_has_text_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
720 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
721 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
722 |
# note: same as the above query but because of the subquery usage, the display differs (not printing solutions for each union) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
723 |
self._test('Any X LIMIT 10 OFFSET 10 WHERE X has_text "bla"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
724 |
[('FetchStep', [('Any E WHERE E type "X", E is Note', [{'E': 'Note'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
725 |
[self.rql, self.system], None, {'E': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
726 |
('UnionFetchStep', [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
727 |
('FetchStep', [('Any X WHERE X has_text "bla", (EXISTS(X owned_by 5)) OR ((((EXISTS(D concerne C?, C owned_by 5, C type "X", X identity D, C is Division, D is Affaire)) OR (EXISTS(H concerne G?, G owned_by 5, G type "X", X identity H, G is SubDivision, H is Affaire))) OR (EXISTS(I concerne F?, F owned_by 5, F type "X", X identity I, F is Societe, I is Affaire))) OR (EXISTS(J concerne E?, E owned_by 5, X identity J, E is Note, J is Affaire))), X is Affaire', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
728 |
[{'C': 'Division', 'E': 'Note', 'D': 'Affaire', 'G': 'SubDivision', 'F': 'Societe', 'I': 'Affaire', 'H': 'Affaire', 'J': 'Affaire', 'X': 'Affaire'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
729 |
[self.system], {'E': 'table1.C0'}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
730 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
731 |
[('Any X WHERE X has_text "bla", EXISTS(X owned_by 5), X is Basket', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
732 |
[{'X': 'Basket'}]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
733 |
('Any X WHERE X has_text "bla", EXISTS(X owned_by 5), X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
734 |
[{'X': 'EUser'}]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
735 |
('Any X WHERE X has_text "bla", X is IN(Card, Comment, Division, Email, EmailThread, File, Folder, Image, Note, Personne, Societe, State, SubDivision, Tag, Transition)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
736 |
[{'X': 'Card'}, {'X': 'Comment'}, {'X': 'Division'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
737 |
{'X': 'Email'}, {'X': 'EmailThread'}, {'X': 'File'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
738 |
{'X': 'Folder'}, {'X': 'Image'}, {'X': 'Note'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
739 |
{'X': 'Personne'}, {'X': 'Societe'}, {'X': 'State'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
740 |
{'X': 'SubDivision'}, {'X': 'Tag'}, {'X': 'Transition'}]),], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
741 |
[self.system], {}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
742 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
743 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
744 |
[('Any X LIMIT 10 OFFSET 10', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
745 |
[{'X': 'Affaire'}, {'X': 'Basket'}, {'X': 'Card'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
746 |
{'X': 'Comment'}, {'X': 'Division'}, {'X': 'EUser'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
747 |
{'X': 'Email'}, {'X': 'EmailThread'}, {'X': 'File'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
748 |
{'X': 'Folder'}, {'X': 'Image'}, {'X': 'Note'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
749 |
{'X': 'Personne'}, {'X': 'Societe'}, {'X': 'State'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
750 |
{'X': 'SubDivision'}, {'X': 'Tag'}, {'X': 'Transition'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
751 |
10, 10, [self.system], {'X': 'table0.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
752 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
753 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
754 |
def test_security_user(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
755 |
"""a guest user trying to see another user: EXISTS(X owned_by U) is automatically inserted""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
756 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
757 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
758 |
self._test('Any X WHERE X login "bla"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
759 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
760 |
[('Any X WHERE X login "bla", X is EUser', [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
761 |
[self.ldap, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
762 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
763 |
[('Any X WHERE EXISTS(X owned_by 5), X is EUser', [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
764 |
None, None, [self.system], {'X': 'table0.C0'}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
765 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
766 |
def test_security_complex_has_text(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
767 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
768 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
769 |
self._test('Any X WHERE X has_text "bla", X firstname "bla"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
770 |
[('FetchStep', [('Any X WHERE X firstname "bla", X is EUser', [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
771 |
[self.ldap, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
772 |
('UnionStep', None, None, [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
773 |
('OneFetchStep', [('Any X WHERE X has_text "bla", EXISTS(X owned_by 5), X is EUser', [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
774 |
None, None, [self.system], {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
775 |
('OneFetchStep', [('Any X WHERE X has_text "bla", X firstname "bla", X is Personne', [{'X': 'Personne'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
776 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
777 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
778 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
779 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
780 |
def test_security_complex_has_text_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
781 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
782 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
783 |
self._test('Any X LIMIT 10 OFFSET 10 WHERE X has_text "bla", X firstname "bla"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
784 |
[('FetchStep', [('Any X WHERE X firstname "bla", X is EUser', [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
785 |
[self.ldap, self.system], None, {'X': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
786 |
('UnionFetchStep', [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
787 |
('FetchStep', [('Any X WHERE X has_text "bla", EXISTS(X owned_by 5), X is EUser', [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
788 |
[self.system], {'X': 'table1.C0'}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
789 |
('FetchStep', [('Any X WHERE X has_text "bla", X firstname "bla", X is Personne', [{'X': 'Personne'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
790 |
[self.system], {}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
791 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
792 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
793 |
[('Any X LIMIT 10 OFFSET 10', [{'X': 'EUser'}, {'X': 'Personne'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
794 |
10, 10, [self.system], {'X': 'table0.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
795 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
796 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
797 |
def test_security_complex_aggregat(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
798 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
799 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
800 |
self._test('Any MAX(X)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
801 |
[('FetchStep', [('Any E WHERE E type "X", E is Note', [{'E': 'Note'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
802 |
[self.rql, self.system], None, {'E': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
803 |
('FetchStep', [('Any X WHERE X is EUser', [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
804 |
[self.ldap, self.system], None, {'X': 'table2.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
805 |
('UnionFetchStep', [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
806 |
('FetchStep', [('Any X WHERE EXISTS(X owned_by 5), X is Basket', [{'X': 'Basket'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
807 |
[self.system], {}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
808 |
('UnionFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
809 |
[('FetchStep', [('Any X WHERE X is IN(Card, Note, State)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
810 |
[{'X': 'Card'}, {'X': 'Note'}, {'X': 'State'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
811 |
[self.rql, self.system], {}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
812 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
813 |
[('Any X WHERE X is IN(Bookmark, Comment, Division, ECache, EConstraint, EConstraintType, EEType, EFRDef, EGroup, ENFRDef, EPermission, EProperty, ERType, Email, EmailAddress, EmailPart, EmailThread, File, Folder, Image, Personne, RQLExpression, Societe, SubDivision, Tag, TrInfo, Transition)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
814 |
sorted([{'X': 'Bookmark'}, {'X': 'Comment'}, {'X': 'Division'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
815 |
{'X': 'ECache'}, {'X': 'EConstraint'}, {'X': 'EConstraintType'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
816 |
{'X': 'EEType'}, {'X': 'EFRDef'}, {'X': 'EGroup'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
817 |
{'X': 'ENFRDef'}, {'X': 'EPermission'}, {'X': 'EProperty'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
818 |
{'X': 'ERType'}, {'X': 'Email'}, {'X': 'EmailAddress'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
819 |
{'X': 'EmailPart'}, {'X': 'EmailThread'}, {'X': 'File'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
820 |
{'X': 'Folder'}, {'X': 'Image'}, {'X': 'Personne'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
821 |
{'X': 'RQLExpression'}, {'X': 'Societe'}, {'X': 'SubDivision'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
822 |
{'X': 'Tag'}, {'X': 'TrInfo'}, {'X': 'Transition'}]))], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
823 |
[self.system], {}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
824 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
825 |
('FetchStep', [('Any X WHERE EXISTS(X owned_by 5), X is EUser', [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
826 |
[self.system], {'X': 'table2.C0'}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
827 |
('FetchStep', [('Any X WHERE (EXISTS(X owned_by 5)) OR ((((EXISTS(D concerne C?, C owned_by 5, C type "X", X identity D, C is Division, D is Affaire)) OR (EXISTS(H concerne G?, G owned_by 5, G type "X", X identity H, G is SubDivision, H is Affaire))) OR (EXISTS(I concerne F?, F owned_by 5, F type "X", X identity I, F is Societe, I is Affaire))) OR (EXISTS(J concerne E?, E owned_by 5, X identity J, E is Note, J is Affaire))), X is Affaire', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
828 |
[{'C': 'Division', 'E': 'Note', 'D': 'Affaire', 'G': 'SubDivision', 'F': 'Societe', 'I': 'Affaire', 'H': 'Affaire', 'J': 'Affaire', 'X': 'Affaire'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
829 |
[self.system], {'E': 'table1.C0'}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
830 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
831 |
('OneFetchStep', [('Any MAX(X)', X_ALL_SOLS)], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
832 |
None, None, [self.system], {'X': 'table0.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
833 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
834 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
835 |
def test_security_complex_aggregat2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
836 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
837 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
838 |
self._test('Any ET, COUNT(X) GROUPBY ET ORDERBY ET WHERE X is ET', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
839 |
[('FetchStep', [('Any X WHERE X is IN(Card, Note, State)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
840 |
[{'X': 'Card'}, {'X': 'Note'}, {'X': 'State'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
841 |
[self.rql, self.system], None, {'X': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
842 |
('FetchStep', [('Any E WHERE E type "X", E is Note', [{'E': 'Note'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
843 |
[self.rql, self.system], None, {'E': 'table2.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
844 |
('FetchStep', [('Any X WHERE X is EUser', [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
845 |
[self.ldap, self.system], None, {'X': 'table3.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
846 |
('UnionFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
847 |
[('FetchStep', [('Any ET,X WHERE X is ET, EXISTS(X owned_by 5), ET is EEType, X is Basket', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
848 |
[{'ET': 'EEType', 'X': 'Basket'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
849 |
[self.system], {}, {'ET': 'table0.C0', 'X': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
850 |
('FetchStep', [('Any ET,X WHERE X is ET, (EXISTS(X owned_by 5)) OR ((((EXISTS(D concerne C?, C owned_by 5, C type "X", X identity D, C is Division, D is Affaire)) OR (EXISTS(H concerne G?, G owned_by 5, G type "X", X identity H, G is SubDivision, H is Affaire))) OR (EXISTS(I concerne F?, F owned_by 5, F type "X", X identity I, F is Societe, I is Affaire))) OR (EXISTS(J concerne E?, E owned_by 5, X identity J, E is Note, J is Affaire))), ET is EEType, X is Affaire', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
851 |
[{'C': 'Division', 'E': 'Note', 'D': 'Affaire', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
852 |
'G': 'SubDivision', 'F': 'Societe', 'I': 'Affaire', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
853 |
'H': 'Affaire', 'J': 'Affaire', 'X': 'Affaire', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
854 |
'ET': 'EEType'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
855 |
[self.system], {'E': 'table2.C0'}, {'ET': 'table0.C0', 'X': 'table0.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
856 |
[]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
857 |
('FetchStep', [('Any ET,X WHERE X is ET, EXISTS(X owned_by 5), ET is EEType, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
858 |
[{'ET': 'EEType', 'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
859 |
[self.system], {'X': 'table3.C0'}, {'ET': 'table0.C0', 'X': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
860 |
# extra UnionFetchStep could be avoided but has no cost, so don't care |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
861 |
('UnionFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
862 |
[('FetchStep', [('Any ET,X WHERE X is ET, ET is EEType, X is IN(Bookmark, Comment, Division, ECache, EConstraint, EConstraintType, EEType, EFRDef, EGroup, ENFRDef, EPermission, EProperty, ERType, Email, EmailAddress, EmailPart, EmailThread, File, Folder, Image, Personne, RQLExpression, Societe, SubDivision, Tag, TrInfo, Transition)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
863 |
[{'X': 'Bookmark', 'ET': 'EEType'}, {'X': 'Comment', 'ET': 'EEType'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
864 |
{'X': 'Division', 'ET': 'EEType'}, {'X': 'ECache', 'ET': 'EEType'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
865 |
{'X': 'EConstraint', 'ET': 'EEType'}, {'X': 'EConstraintType', 'ET': 'EEType'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
866 |
{'X': 'EEType', 'ET': 'EEType'}, {'X': 'EFRDef', 'ET': 'EEType'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
867 |
{'X': 'EGroup', 'ET': 'EEType'}, {'X': 'ENFRDef', 'ET': 'EEType'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
868 |
{'X': 'EPermission', 'ET': 'EEType'}, {'X': 'EProperty', 'ET': 'EEType'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
869 |
{'X': 'ERType', 'ET': 'EEType'}, {'X': 'Email', 'ET': 'EEType'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
870 |
{'X': 'EmailAddress', 'ET': 'EEType'}, {'X': 'EmailPart', 'ET': 'EEType'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
871 |
{'X': 'EmailThread', 'ET': 'EEType'}, {'X': 'File', 'ET': 'EEType'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
872 |
{'X': 'Folder', 'ET': 'EEType'}, {'X': 'Image', 'ET': 'EEType'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
873 |
{'X': 'Personne', 'ET': 'EEType'}, {'X': 'RQLExpression', 'ET': 'EEType'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
874 |
{'X': 'Societe', 'ET': 'EEType'}, {'X': 'SubDivision', 'ET': 'EEType'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
875 |
{'X': 'Tag', 'ET': 'EEType'}, {'X': 'TrInfo', 'ET': 'EEType'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
876 |
{'X': 'Transition', 'ET': 'EEType'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
877 |
[self.system], {}, {'ET': 'table0.C0', 'X': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
878 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
879 |
[('Any ET,X WHERE X is ET, ET is EEType, X is IN(Card, Note, State)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
880 |
[{'ET': 'EEType', 'X': 'Card'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
881 |
{'ET': 'EEType', 'X': 'Note'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
882 |
{'ET': 'EEType', 'X': 'State'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
883 |
[self.system], {'X': 'table1.C0'}, {'ET': 'table0.C0', 'X': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
884 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
885 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
886 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
887 |
[('Any ET,COUNT(X) GROUPBY ET ORDERBY ET', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
888 |
sorted([{'ET': 'EEType', 'X': 'Affaire'}, {'ET': 'EEType', 'X': 'Basket'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
889 |
{'ET': 'EEType', 'X': 'Bookmark'}, {'ET': 'EEType', 'X': 'Card'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
890 |
{'ET': 'EEType', 'X': 'Comment'}, {'ET': 'EEType', 'X': 'Division'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
891 |
{'ET': 'EEType', 'X': 'ECache'}, {'ET': 'EEType', 'X': 'EConstraint'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
892 |
{'ET': 'EEType', 'X': 'EConstraintType'}, {'ET': 'EEType', 'X': 'EEType'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
893 |
{'ET': 'EEType', 'X': 'EFRDef'}, {'ET': 'EEType', 'X': 'EGroup'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
894 |
{'ET': 'EEType', 'X': 'ENFRDef'}, {'ET': 'EEType', 'X': 'EPermission'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
895 |
{'ET': 'EEType', 'X': 'EProperty'}, {'ET': 'EEType', 'X': 'ERType'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
896 |
{'ET': 'EEType', 'X': 'EUser'}, {'ET': 'EEType', 'X': 'Email'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
897 |
{'ET': 'EEType', 'X': 'EmailAddress'}, {'ET': 'EEType', 'X': 'EmailPart'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
898 |
{'ET': 'EEType', 'X': 'EmailThread'}, {'ET': 'EEType', 'X': 'File'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
899 |
{'ET': 'EEType', 'X': 'Folder'}, {'ET': 'EEType', 'X': 'Image'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
900 |
{'ET': 'EEType', 'X': 'Note'}, {'ET': 'EEType', 'X': 'Personne'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
901 |
{'ET': 'EEType', 'X': 'RQLExpression'}, {'ET': 'EEType', 'X': 'Societe'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
902 |
{'ET': 'EEType', 'X': 'State'}, {'ET': 'EEType', 'X': 'SubDivision'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
903 |
{'ET': 'EEType', 'X': 'Tag'}, {'ET': 'EEType', 'X': 'TrInfo'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
904 |
{'ET': 'EEType', 'X': 'Transition'}]))], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
905 |
None, None, [self.system], {'ET': 'table0.C0', 'X': 'table0.C1'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
906 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
907 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
908 |
def test_security_3sources(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
909 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
910 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
911 |
self._test('Any X, XT WHERE X is Card, X owned_by U, X title XT, U login "syt"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
912 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
913 |
[('Any X,XT WHERE X title XT, X is Card', [{'X': 'Card', 'XT': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
914 |
[self.rql, self.system], None, {'X': 'table0.C0', 'X.title': 'table0.C1', 'XT': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
915 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
916 |
[('Any U WHERE U login "syt", U is EUser', [{'U': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
917 |
[self.ldap, self.system], None, {'U': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
918 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
919 |
[('Any X,XT WHERE X owned_by U, X title XT, EXISTS(U owned_by 5), U is EUser, X is Card', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
920 |
[{'X': 'Card', 'U': 'EUser', 'XT': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
921 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
922 |
{'X': 'table0.C0', 'X.title': 'table0.C1', 'XT': 'table0.C1', 'U': 'table1.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
923 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
924 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
925 |
def test_security_3sources_identity(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
926 |
self.restore_orig_euser_security() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
927 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
928 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
929 |
self._test('Any X, XT WHERE X is Card, X owned_by U, X title XT, U login "syt"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
930 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
931 |
[('Any X,XT WHERE X title XT, X is Card', [{'X': 'Card', 'XT': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
932 |
[self.rql, self.system], None, {'X': 'table0.C0', 'X.title': 'table0.C1', 'XT': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
933 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
934 |
[('Any X,XT WHERE X owned_by U, X title XT, U login "syt", EXISTS(U identity 5), U is EUser, X is Card', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
935 |
[{'U': 'EUser', 'X': 'Card', 'XT': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
936 |
None, None, [self.system], {'X': 'table0.C0', 'X.title': 'table0.C1', 'XT': 'table0.C1'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
937 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
938 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
939 |
def test_security_3sources_identity_optional_var(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
940 |
self.restore_orig_euser_security() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
941 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
942 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
943 |
self._test('Any X,XT,U WHERE X is Card, X owned_by U?, X title XT, U login L', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
944 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
945 |
[('Any U,L WHERE U identity 5, U login L, U is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
946 |
[{'L': 'String', u'U': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
947 |
[self.system], {}, {'L': 'table0.C1', 'U': 'table0.C0', 'U.login': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
948 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
949 |
[('Any X,XT WHERE X title XT, X is Card', [{'X': 'Card', 'XT': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
950 |
[self.rql, self.system], None, {'X': 'table1.C0', 'X.title': 'table1.C1', 'XT': 'table1.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
951 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
952 |
[('Any X,XT,U WHERE X owned_by U?, X title XT, X is Card', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
953 |
[{'X': 'Card', 'XT': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
954 |
None, None, [self.system], {'L': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
955 |
'U': 'table0.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
956 |
'X': 'table1.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
957 |
'X.title': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
958 |
'XT': 'table1.C1'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
959 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
960 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
961 |
def test_security_3sources_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
962 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
963 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
964 |
self._test('Any X, XT LIMIT 10 OFFSET 10 WHERE X is Card, X owned_by U, X title XT, U login "syt"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
965 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
966 |
[('Any X,XT WHERE X title XT, X is Card', [{'X': 'Card', 'XT': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
967 |
[self.rql, self.system], None, {'X': 'table0.C0', 'X.title': 'table0.C1', 'XT': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
968 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
969 |
[('Any U WHERE U login "syt", U is EUser', [{'U': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
970 |
[self.ldap, self.system], None, {'U': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
971 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
972 |
[('Any X,XT LIMIT 10 OFFSET 10 WHERE X owned_by U, X title XT, EXISTS(U owned_by 5), U is EUser, X is Card', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
973 |
[{'X': 'Card', 'U': 'EUser', 'XT': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
974 |
10, 10, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
975 |
{'X': 'table0.C0', 'X.title': 'table0.C1', 'XT': 'table0.C1', 'U': 'table1.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
976 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
977 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
978 |
def test_exists_base(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
979 |
self._test('Any X,L,S WHERE X in_state S, X login L, EXISTS(X in_group G, G name "bougloup")', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
980 |
[('FetchStep', [('Any X,L WHERE X login L, X is EUser', [{'X': 'EUser', 'L': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
981 |
[self.ldap, self.system], None, {'X': 'table0.C0', 'X.login': 'table0.C1', 'L': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
982 |
('OneFetchStep', [("Any X,L,S WHERE X in_state S, X login L, " |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
983 |
'EXISTS(X in_group G, G name "bougloup", G is EGroup), S is State, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
984 |
[{'X': 'EUser', 'L': 'String', 'S': 'State', 'G': 'EGroup'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
985 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
986 |
{'X': 'table0.C0', 'X.login': 'table0.C1', 'L': 'table0.C1'}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
987 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
988 |
def test_exists_complex(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
989 |
self._test('Any G WHERE X in_group G, G name "managers", EXISTS(X copain T, T login in ("comme", "cochon"))', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
990 |
[('FetchStep', [('Any T WHERE T login IN("comme", "cochon"), T is EUser', [{'T': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
991 |
[self.ldap, self.system], None, {'T': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
992 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
993 |
[('Any G WHERE X in_group G, G name "managers", EXISTS(X copain T, T is EUser), G is EGroup, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
994 |
[{'X': 'EUser', 'T': 'EUser', 'G': 'EGroup'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
995 |
None, None, [self.system], {'T': 'table0.C0'}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
996 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
997 |
def test_exists3(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
998 |
self._test('Any G,L WHERE X in_group G, X login L, G name "managers", EXISTS(X copain T, T login in ("comme", "cochon"))', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
999 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1000 |
[('Any T WHERE T login IN("comme", "cochon"), T is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1001 |
[{'T': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1002 |
[self.ldap, self.system], None, {'T': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1003 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1004 |
[('Any L,X WHERE X login L, X is EUser', [{'X': 'EUser', 'L': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1005 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1006 |
{'X': 'table1.C1', 'X.login': 'table1.C0', 'L': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1007 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1008 |
[('Any G,L WHERE X in_group G, X login L, G name "managers", EXISTS(X copain T, T is EUser), G is EGroup, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1009 |
[{'G': 'EGroup', 'L': 'String', 'T': 'EUser', 'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1010 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1011 |
[self.system], {'T': 'table0.C0', 'X': 'table1.C1', 'X.login': 'table1.C0', 'L': 'table1.C0'}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1012 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1013 |
def test_exists4(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1014 |
self._test('Any G,L WHERE X in_group G, X login L, G name "managers", ' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1015 |
'EXISTS(X copain T, T login L, T login in ("comme", "cochon")) OR ' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1016 |
'EXISTS(X in_state S, S name "pascontent", NOT X copain T2, T2 login "billy")', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1017 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1018 |
[('Any T,L WHERE T login L, T login IN("comme", "cochon"), T is EUser', [{'T': 'EUser', 'L': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1019 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1020 |
{'T': 'table0.C0', 'T.login': 'table0.C1', 'L': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1021 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1022 |
[('Any T2 WHERE T2 login "billy", T2 is EUser', [{'T2': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1023 |
[self.ldap, self.system], None, {'T2': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1024 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1025 |
[('Any L,X WHERE X login L, X is EUser', [{'X': 'EUser', 'L': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1026 |
[self.ldap, self.system], None, {'X': 'table2.C1', 'X.login': 'table2.C0', 'L': 'table2.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1027 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1028 |
[('Any G,L WHERE X in_group G, X login L, G name "managers", (EXISTS(X copain T, T login L, T is EUser)) OR (EXISTS(X in_state S, S name "pascontent", NOT X copain T2, S is State, T2 is EUser)), G is EGroup, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1029 |
[{'G': 'EGroup', 'L': 'String', 'S': 'State', 'T': 'EUser', 'T2': 'EUser', 'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1030 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1031 |
{'T2': 'table1.C0', 'L': 'table2.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1032 |
'T': 'table0.C0', 'T.login': 'table0.C1', 'X': 'table2.C1', 'X.login': 'table2.C0'}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1033 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1034 |
def test_exists5(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1035 |
self._test('Any GN,L WHERE X in_group G, X login L, G name GN, ' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1036 |
'EXISTS(X copain T, T login in ("comme", "cochon")) AND ' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1037 |
'NOT EXISTS(X copain T2, T2 login "billy")', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1038 |
[('FetchStep', [('Any T WHERE T login IN("comme", "cochon"), T is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1039 |
[{'T': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1040 |
[self.ldap, self.system], None, {'T': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1041 |
('FetchStep', [('Any T2 WHERE T2 login "billy", T2 is EUser', [{'T2': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1042 |
[self.ldap, self.system], None, {'T2': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1043 |
('FetchStep', [('Any L,X WHERE X login L, X is EUser', [{'X': 'EUser', 'L': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1044 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1045 |
{'X': 'table2.C1', 'X.login': 'table2.C0', 'L': 'table2.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1046 |
('OneFetchStep', [('Any GN,L WHERE X in_group G, X login L, G name GN, EXISTS(X copain T, T is EUser), NOT EXISTS(X copain T2, T2 is EUser), G is EGroup, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1047 |
[{'G': 'EGroup', 'GN': 'String', 'L': 'String', 'T': 'EUser', 'T2': 'EUser', 'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1048 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1049 |
{'T': 'table0.C0', 'T2': 'table1.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1050 |
'X': 'table2.C1', 'X.login': 'table2.C0', 'L': 'table2.C0'}, [])]) |
392 | 1051 |
|
1052 |
def test_exists_security_no_invariant(self): |
|
1053 |
ueid = self.session.user.eid |
|
1054 |
self._test('Any X,AA,AB,AC,AD ORDERBY AA WHERE X is EUser, X login AA, X firstname AB, X surname AC, X modification_date AD, A eid %(B)s, \ |
|
1055 |
EXISTS(((X identity A) OR \ |
|
1056 |
(EXISTS(X in_group C, C name IN("managers", "staff"), C is EGroup))) OR \ |
|
1057 |
(EXISTS(X in_group D, A in_group D, NOT D name "users", D is EGroup)))', |
|
1058 |
[('FetchStep', [('Any X,AA,AB,AC,AD WHERE X login AA, X firstname AB, X surname AC, X modification_date AD, X is EUser', |
|
1059 |
[{'AA': 'String', 'AB': 'String', 'AC': 'String', 'AD': 'Datetime', |
|
1060 |
'X': 'EUser'}])], |
|
1061 |
[self.ldap, self.system], None, {'AA': 'table0.C1', 'AB': 'table0.C2', |
|
1062 |
'AC': 'table0.C3', 'AD': 'table0.C4', |
|
1063 |
'X': 'table0.C0', |
|
1064 |
'X.firstname': 'table0.C2', |
|
1065 |
'X.login': 'table0.C1', |
|
1066 |
'X.modification_date': 'table0.C4', |
|
1067 |
'X.surname': 'table0.C3'}, []), |
|
1068 |
('OneFetchStep', [('Any X,AA,AB,AC,AD ORDERBY AA WHERE X login AA, X firstname AB, X surname AC, X modification_date AD, EXISTS(((X identity 5) OR (EXISTS(X in_group C, C name IN("managers", "staff"), C is EGroup))) OR (EXISTS(X in_group D, 5 in_group D, NOT D name "users", D is EGroup))), X is EUser', |
|
1069 |
[{'AA': 'String', 'AB': 'String', 'AC': 'String', 'AD': 'Datetime', |
|
1070 |
'C': 'EGroup', 'D': 'EGroup', 'X': 'EUser'}])], |
|
1071 |
None, None, [self.system], |
|
1072 |
{'AA': 'table0.C1', 'AB': 'table0.C2', 'AC': 'table0.C3', 'AD': 'table0.C4', |
|
1073 |
'X': 'table0.C0', |
|
1074 |
'X.firstname': 'table0.C2', 'X.login': 'table0.C1', 'X.modification_date': 'table0.C4', 'X.surname': 'table0.C3'}, |
|
1075 |
[])], |
|
1076 |
{'B': ueid}) |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1077 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1078 |
def test_relation_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1079 |
self._test('Any X, S WHERE X in_state S', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1080 |
[('UnionStep', None, None, [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1081 |
('OneFetchStep', [('Any X,S WHERE X in_state S, S is State, X is IN(Affaire, EUser)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1082 |
[{'X': 'Affaire', 'S': 'State'}, {'X': 'EUser', 'S': 'State'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1083 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1084 |
('OneFetchStep', [('Any X,S WHERE X in_state S, S is State, X is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1085 |
[{'X': 'Note', 'S': 'State'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1086 |
None, None, [self.rql, self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1087 |
])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1088 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1089 |
def test_relation_selection_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1090 |
self._test('Any X,S,U WHERE X in_state S, X todo_by U', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1091 |
[('FetchStep', [('Any X,S WHERE X in_state S, S is State, X is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1092 |
[{'X': 'Note', 'S': 'State'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1093 |
[self.rql, self.system], None, {'X': 'table0.C0', 'S': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1094 |
('UnionStep', None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1095 |
[('OneFetchStep', [('Any X,S,U WHERE X in_state S, X todo_by U, S is State, U is EUser, X is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1096 |
[{'X': 'Note', 'S': 'State', 'U': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1097 |
None, None, [self.system], {'X': 'table0.C0', 'S': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1098 |
('OneFetchStep', [('Any X,S,U WHERE X in_state S, X todo_by U, S is State, U is Personne, X is Affaire', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1099 |
[{'X': 'Affaire', 'S': 'State', 'U': 'Personne'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1100 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1101 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1102 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1103 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1104 |
def test_relation_restriction_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1105 |
self._test('Any X,U WHERE X in_state S, S name "pending", X todo_by U', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1106 |
[('FetchStep', [('Any X WHERE X in_state S, S name "pending", S is State, X is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1107 |
[{'X': 'Note', 'S': 'State'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1108 |
[self.rql, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1109 |
('UnionStep', None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1110 |
[('OneFetchStep', [('Any X,U WHERE X todo_by U, U is EUser, X is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1111 |
[{'X': 'Note', 'U': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1112 |
None, None, [self.system], {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1113 |
('OneFetchStep', [('Any X,U WHERE X in_state S, S name "pending", X todo_by U, S is State, U is Personne, X is Affaire', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1114 |
[{'S': 'State', 'U': 'Personne', 'X': 'Affaire'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1115 |
None, None, [self.system], {}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1116 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1117 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1118 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1119 |
def test_relation_restriction_ambigous_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1120 |
self._test('Any X,T WHERE X in_state S, S name "pending", T tags X', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1121 |
[('FetchStep', [('Any X WHERE X in_state S, S name "pending", S is State, X is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1122 |
[{'X': 'Note', 'S': 'State'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1123 |
[self.rql, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1124 |
('UnionStep', None, None, [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1125 |
('OneFetchStep', [('Any X,T WHERE T tags X, T is Tag, X is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1126 |
[{'X': 'Note', 'T': 'Tag'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1127 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1128 |
[self.system], {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1129 |
('OneFetchStep', [('Any X,T WHERE X in_state S, S name "pending", T tags X, S is State, T is Tag, X is IN(Affaire, EUser)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1130 |
[{'X': 'Affaire', 'S': 'State', 'T': 'Tag'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1131 |
{'X': 'EUser', 'S': 'State', 'T': 'Tag'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1132 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1133 |
[self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1134 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1135 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1136 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1137 |
def test_not_relation_no_split_internal(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1138 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1139 |
# NOT on a relation supported by rql and system source: we want to get |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1140 |
# all states (eg from both sources) which are not related to entity with the |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1141 |
# given eid. The "NOT X in_state S, X eid %(x)s" expression is necessarily true |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1142 |
# in the source where %(x)s is not coming from and will be removed during rql |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1143 |
# generation for the external source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1144 |
self._test('Any SN WHERE NOT X in_state S, X eid %(x)s, S name SN', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1145 |
[('OneFetchStep', [('Any SN WHERE NOT 5 in_state S, S name SN, S is State', [{'S': 'State', 'SN': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1146 |
None, None, [self.rql, self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1147 |
{'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1148 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1149 |
def test_not_relation_no_split_external(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1150 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1151 |
# similar to the above test but with an eid coming from the external source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1152 |
self._test('Any SN WHERE NOT X in_state S, X eid %(x)s, S name SN', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1153 |
[('UnionStep', None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1154 |
[('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1155 |
[('Any SN WHERE NOT 999999 in_state S, S name SN, S is State', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1156 |
[{'S': 'State', 'SN': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1157 |
None, None, [self.rql], {}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1158 |
[]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1159 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1160 |
[('Any SN WHERE S name SN, S is State', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1161 |
[{'S': 'State', 'SN': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1162 |
None, None, [self.system], {}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1163 |
[])] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1164 |
)], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1165 |
{'x': 999999}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1166 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1167 |
def test_not_relation_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1168 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1169 |
self._test('Any SN WHERE NOT X in_state S, S name SN', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1170 |
[('FetchStep', [('Any SN,S WHERE S name SN, S is State', [{'S': 'State', 'SN': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1171 |
[self.rql, self.system], None, {'S': 'table0.C1', 'S.name': 'table0.C0', 'SN': 'table0.C0'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1172 |
[]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1173 |
('FetchStep', [('Any X WHERE X is Note', [{'X': 'Note'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1174 |
[self.rql, self.system], None, {'X': 'table1.C0'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1175 |
[]), |
341
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1176 |
('IntersectStep', None, None, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1177 |
[('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1178 |
[('Any SN WHERE NOT X in_state S, S name SN, S is State, X is IN(Affaire, EUser)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1179 |
[{'S': 'State', 'SN': 'String', 'X': 'Affaire'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1180 |
{'S': 'State', 'SN': 'String', 'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1181 |
None, None, [self.system], {'S': 'table0.C1', 'S.name': 'table0.C0', 'SN': 'table0.C0'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1182 |
[]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1183 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1184 |
[('Any SN WHERE NOT X in_state S, S name SN, S is State, X is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1185 |
[{'S': 'State', 'SN': 'String', 'X': 'Note'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1186 |
None, None, [self.system], {'S': 'table0.C1', 'S.name': 'table0.C0', 'SN': 'table0.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1187 |
'X': 'table1.C0'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1188 |
[])] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1189 |
)]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1190 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1191 |
def test_external_attributes_and_relation(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1192 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1193 |
self._test('Any A,B,C,D WHERE A eid %(x)s,A creation_date B,A modification_date C, A todo_by D?', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1194 |
[('FetchStep', [('Any A,B,C WHERE A eid 999999, A creation_date B, A modification_date C, A is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1195 |
[{'A': 'Note', 'C': 'Datetime', 'B': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1196 |
[self.rql], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1197 |
{'A': 'table0.C0', 'A.creation_date': 'table0.C1', 'A.modification_date': 'table0.C2', 'C': 'table0.C2', 'B': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1198 |
#('FetchStep', [('Any D WHERE D is EUser', [{'D': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1199 |
# [self.ldap, self.system], None, {'D': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1200 |
('OneFetchStep', [('Any A,B,C,D WHERE A creation_date B, A modification_date C, A todo_by D?, A is Note, D is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1201 |
[{'A': 'Note', 'C': 'Datetime', 'B': 'Datetime', 'D': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1202 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1203 |
{'A': 'table0.C0', 'A.creation_date': 'table0.C1', 'A.modification_date': 'table0.C2', 'C': 'table0.C2', 'B': 'table0.C1'}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1204 |
{'x': 999999}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1205 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1206 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1207 |
def test_simplified_var(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1208 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1209 |
self._test('Any U WHERE U in_group G, (G name IN ("managers", "logilab") OR (X require_permission P?, P name "bla", P require_group G)), X eid %(x)s, U eid %(u)s', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1210 |
[('OneFetchStep', [('Any 5 WHERE 5 in_group G, (G name IN("managers", "logilab")) OR (X require_permission P?, P name "bla", P require_group G), X eid 999999', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1211 |
[{'X': 'Note', 'G': 'EGroup', 'P': 'EPermission'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1212 |
None, None, [self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1213 |
{'x': 999999, 'u': self.session.user.eid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1214 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1215 |
def test_has_text(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1216 |
self._test('Card X WHERE X has_text "toto"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1217 |
[('OneFetchStep', [('Any X WHERE X has_text "toto", X is Card', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1218 |
[{'X': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1219 |
None, None, [self.system], {}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1220 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1221 |
def test_has_text_3(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1222 |
self._test('Any X WHERE X has_text "toto", X title "zoubidou"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1223 |
[('FetchStep', [(u'Any X WHERE X title "zoubidou", X is Card', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1224 |
[{'X': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1225 |
[self.rql, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1226 |
('UnionStep', None, None, [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1227 |
('OneFetchStep', [(u'Any X WHERE X has_text "toto", X is Card', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1228 |
[{'X': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1229 |
None, None, [self.system], {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1230 |
('OneFetchStep', [(u'Any X WHERE X has_text "toto", X title "zoubidou", X is EmailThread', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1231 |
[{'X': 'EmailThread'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1232 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1233 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1234 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1235 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1236 |
def test_sort_func(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1237 |
self._test('Note X ORDERBY DUMB_SORT(RF) WHERE X type RF', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1238 |
[('AggrStep', 'Any X ORDERBY DUMB_SORT(RF)', None, None, 'table0', None, [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1239 |
('FetchStep', [('Any X,RF WHERE X type RF, X is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1240 |
[{'X': 'Note', 'RF': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1241 |
[self.rql, self.system], {}, {'X': 'table0.C0', 'X.type': 'table0.C1', 'RF': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1242 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1243 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1244 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1245 |
def test_ambigous_sort_func(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1246 |
self._test('Any X ORDERBY DUMB_SORT(RF) WHERE X title RF', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1247 |
[('AggrStep', 'Any X ORDERBY DUMB_SORT(RF)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1248 |
None, None, 'table0', None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1249 |
[('FetchStep', [('Any X,RF WHERE X title RF, X is Card', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1250 |
[{'X': 'Card', 'RF': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1251 |
[self.rql, self.system], {}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1252 |
{'X': 'table0.C0', 'X.title': 'table0.C1', 'RF': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1253 |
('FetchStep', [('Any X,RF WHERE X title RF, X is IN(Bookmark, EmailThread)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1254 |
[{'RF': 'String', 'X': 'Bookmark'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1255 |
{'RF': 'String', 'X': 'EmailThread'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1256 |
[self.system], {}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1257 |
{'X': 'table0.C0', 'X.title': 'table0.C1', 'RF': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1258 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1259 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1260 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1261 |
def test_attr_unification_1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1262 |
self._test('Any X,Y WHERE X is Bookmark, Y is Card, X title T, Y title T', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1263 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1264 |
[('Any Y,T WHERE Y title T, Y is Card', [{'T': 'String', 'Y': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1265 |
[self.rql, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1266 |
{'T': 'table0.C1', 'Y': 'table0.C0', 'Y.title': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1267 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1268 |
[('Any X,Y WHERE X title T, Y title T, X is Bookmark, Y is Card', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1269 |
[{'T': 'String', 'X': 'Bookmark', 'Y': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1270 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1271 |
{'T': 'table0.C1', 'Y': 'table0.C0', 'Y.title': 'table0.C1'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1272 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1273 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1274 |
def test_attr_unification_2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1275 |
self._test('Any X,Y WHERE X is Note, Y is Card, X type T, Y title T', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1276 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1277 |
[('Any X,T WHERE X type T, X is Note', [{'T': 'String', 'X': 'Note'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1278 |
[self.rql, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1279 |
{'T': 'table0.C1', 'X': 'table0.C0', 'X.type': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1280 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1281 |
[('Any Y,T WHERE Y title T, Y is Card', [{'T': 'String', 'Y': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1282 |
[self.rql, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1283 |
{'T': 'table1.C1', 'Y': 'table1.C0', 'Y.title': 'table1.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1284 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1285 |
[('Any X,Y WHERE X type T, Y title T, X is Note, Y is Card', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1286 |
[{'T': 'String', 'X': 'Note', 'Y': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1287 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1288 |
{'T': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1289 |
'X': 'table0.C0', 'X.type': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1290 |
'Y': 'table1.C0', 'Y.title': 'table1.C1'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1291 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1292 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1293 |
def test_attr_unification_neq_1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1294 |
self._test('Any X,Y WHERE X is Bookmark, Y is Card, X creation_date D, Y creation_date > D', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1295 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1296 |
[('Any Y,D WHERE Y creation_date > D, Y is Card', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1297 |
[{'D': 'Datetime', 'Y': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1298 |
[self.rql,self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1299 |
{'D': 'table0.C1', 'Y': 'table0.C0', 'Y.creation_date': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1300 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1301 |
[('Any X,Y WHERE X creation_date D, Y creation_date > D, X is Bookmark, Y is Card', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1302 |
[{'D': 'Datetime', 'X': 'Bookmark', 'Y': 'Card'}])], None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1303 |
[self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1304 |
{'D': 'table0.C1', 'Y': 'table0.C0', 'Y.creation_date': 'table0.C1'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1305 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1306 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1307 |
def test_subquery_1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1308 |
self._test('DISTINCT Any B,C ORDERBY C WHERE A created_by B, B login C, EXISTS(B owned_by D), D eid %(E)s ' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1309 |
'WITH A,N BEING ((Any X,N WHERE X is Tag, X name N) UNION (Any X,T WHERE X is Bookmark, X title T))', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1310 |
[('FetchStep', [('Any X,N WHERE X is Tag, X name N', [{'N': 'String', 'X': 'Tag'}]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1311 |
('Any X,T WHERE X is Bookmark, X title T', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1312 |
[{'T': 'String', 'X': 'Bookmark'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1313 |
[self.system], {}, {'N': 'table0.C1', 'X': 'table0.C0', 'X.name': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1314 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1315 |
[('Any B,C WHERE B login C, B is EUser', [{'B': 'EUser', 'C': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1316 |
[self.ldap, self.system], None, {'B': 'table1.C0', 'B.login': 'table1.C1', 'C': 'table1.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1317 |
('OneFetchStep', [('DISTINCT Any B,C ORDERBY C WHERE A created_by B, B login C, EXISTS(B owned_by 5), B is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1318 |
[{'A': 'Bookmark', 'B': 'EUser', 'C': 'String'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1319 |
{'A': 'Tag', 'B': 'EUser', 'C': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1320 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1321 |
{'A': 'table0.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1322 |
'B': 'table1.C0', 'B.login': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1323 |
'C': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1324 |
'N': 'table0.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1325 |
[])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1326 |
{'E': self.session.user.eid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1327 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1328 |
def test_subquery_2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1329 |
self._test('DISTINCT Any B,C ORDERBY C WHERE A created_by B, B login C, EXISTS(B owned_by D), D eid %(E)s ' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1330 |
'WITH A,N BEING ((Any X,N WHERE X is Tag, X name N) UNION (Any X,T WHERE X is Card, X title T))', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1331 |
[('UnionFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1332 |
[('FetchStep', [('Any X,N WHERE X is Tag, X name N', [{'N': 'String', 'X': 'Tag'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1333 |
[self.system], {}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1334 |
{'N': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1335 |
'T': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1336 |
'X': 'table0.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1337 |
'X.name': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1338 |
'X.title': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1339 |
('FetchStep', [('Any X,T WHERE X is Card, X title T', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1340 |
[{'T': 'String', 'X': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1341 |
[self.rql, self.system], {}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1342 |
{'N': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1343 |
'T': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1344 |
'X': 'table0.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1345 |
'X.name': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1346 |
'X.title': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1347 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1348 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1349 |
[('Any B,C WHERE B login C, B is EUser', [{'B': 'EUser', 'C': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1350 |
[self.ldap, self.system], None, {'B': 'table1.C0', 'B.login': 'table1.C1', 'C': 'table1.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1351 |
('OneFetchStep', [('DISTINCT Any B,C ORDERBY C WHERE A created_by B, B login C, EXISTS(B owned_by 5), B is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1352 |
[{'A': 'Card', 'B': 'EUser', 'C': 'String'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1353 |
{'A': 'Tag', 'B': 'EUser', 'C': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1354 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1355 |
{'A': 'table0.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1356 |
'B': 'table1.C0', 'B.login': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1357 |
'C': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1358 |
'N': 'table0.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1359 |
[])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1360 |
{'E': self.session.user.eid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1361 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1362 |
def test_eid_dont_cross_relation(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1363 |
repo._type_source_cache[999999] = ('Personne', 'system', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1364 |
self._test('Any Y,YT WHERE X eid %(x)s, X fiche Y, Y title YT', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1365 |
[('OneFetchStep', [('Any Y,YT WHERE X eid 999999, X fiche Y, Y title YT', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1366 |
[{'X': 'Personne', 'Y': 'Card', 'YT': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1367 |
None, None, [self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1368 |
{'x': 999999}) |
393 | 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,}) |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1456 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1457 |
# edition queries tests ################################################### |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1458 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1459 |
def test_insert_simplified_var_1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1460 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1461 |
repo._type_source_cache[999998] = ('State', 'system', None) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1462 |
self._test('INSERT Note X: X in_state S, X type T WHERE S eid %(s)s, N eid %(n)s, N type T', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1463 |
[('FetchStep', [('Any T WHERE N eid 999999, N type T, N is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1464 |
[{'N': 'Note', 'T': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1465 |
[self.rql], None, {'N.type': 'table0.C0', 'T': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1466 |
('InsertStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1467 |
[('RelationsStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1468 |
[('OneFetchStep', [('Any 999998,T WHERE N type T, N is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1469 |
[{'N': 'Note', 'T': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1470 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1471 |
{'N.type': 'table0.C0', 'T': 'table0.C0'}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1472 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1473 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1474 |
{'n': 999999, 's': 999998}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1475 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1476 |
def test_insert_simplified_var_2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1477 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1478 |
repo._type_source_cache[999998] = ('State', 'system', None) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1479 |
self._test('INSERT Note X: X in_state S, X type T, X migrated_from N WHERE S eid %(s)s, N eid %(n)s, N type T', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1480 |
[('FetchStep', [('Any T,N WHERE N eid 999999, N type T, N is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1481 |
[{'N': 'Note', 'T': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1482 |
[self.rql], None, {'N': 'table0.C1', 'N.type': 'table0.C0', 'T': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1483 |
('InsertStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1484 |
[('RelationsStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1485 |
[('OneFetchStep', [('Any 999998,T,N WHERE N type T, N is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1486 |
[{'N': 'Note', 'T': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1487 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1488 |
{'N': 'table0.C1', 'N.type': 'table0.C0', 'T': 'table0.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1489 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1490 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1491 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1492 |
{'n': 999999, 's': 999998}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1493 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1494 |
def test_insert_simplified_var_3(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1495 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1496 |
repo._type_source_cache[999998] = ('State', 'cards', 999998) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1497 |
self._test('INSERT Note X: X in_state S, X type T WHERE S eid %(s)s, N eid %(n)s, N type T', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1498 |
[('InsertStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1499 |
[('RelationsStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1500 |
[('OneFetchStep', [('Any 999998,T WHERE N eid 999999, N type T, N is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1501 |
[{'N': 'Note', 'T': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1502 |
None, None, [self.rql], {}, [])] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1503 |
)] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1504 |
)], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1505 |
{'n': 999999, 's': 999998}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1506 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1507 |
def test_insert_simplified_var_4(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1508 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1509 |
repo._type_source_cache[999998] = ('State', 'system', None) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1510 |
self._test('INSERT Note X: X in_state S, X type "bla", X migrated_from N WHERE S eid %(s)s, N eid %(n)s', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1511 |
[('InsertStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1512 |
[('RelationsStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1513 |
[('OneFetchStep', [('Any 999998,999999', [{}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1514 |
None, None, [self.system], {}, [])] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1515 |
)] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1516 |
)], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1517 |
{'n': 999999, 's': 999998}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1518 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1519 |
def test_insert_simplified_var_5(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1520 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1521 |
repo._type_source_cache[999998] = ('State', 'system', None) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1522 |
self._test('INSERT Note X: X in_state S, X type "bla", X migrated_from N WHERE S eid %(s)s, N eid %(n)s, A concerne N', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1523 |
[('InsertStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1524 |
[('RelationsStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1525 |
[('OneFetchStep', [('Any 999998,999999 WHERE A concerne 999999, A is Affaire', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1526 |
[{'A': 'Affaire'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1527 |
None, None, [self.system], {}, [])] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1528 |
)] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1529 |
)], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1530 |
{'n': 999999, 's': 999998}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1531 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1532 |
def test_delete_relation1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1533 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1534 |
self._test('DELETE X created_by Y WHERE X eid %(x)s, NOT Y eid %(y)s', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1535 |
[('DeleteRelationsStep', [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1536 |
('OneFetchStep', [('Any 5,Y WHERE %s created_by Y, NOT Y eid %s, Y is EUser'%(ueid, ueid), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1537 |
[{'Y': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1538 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1539 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1540 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1541 |
{'x': ueid, 'y': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1542 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1543 |
def test_delete_relation2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1544 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1545 |
self._test('DELETE X created_by Y WHERE X eid %(x)s, NOT Y login "syt"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1546 |
[('FetchStep', [('Any Y WHERE NOT Y login "syt", Y is EUser', [{'Y': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1547 |
[self.ldap, self.system], None, {'Y': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1548 |
('DeleteRelationsStep', [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1549 |
('OneFetchStep', [('Any %s,Y WHERE %s created_by Y, Y is EUser'%(ueid,ueid), [{'Y': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1550 |
None, None, [self.system], {'Y': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1551 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1552 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1553 |
{'x': ueid, 'y': ueid}) |
341
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1554 |
|
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1555 |
def test_delete_entity1(self): |
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1556 |
repo._type_source_cache[999999] = ('Note', 'system', 999999) |
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1557 |
self._test('DELETE Note X WHERE X eid %(x)s, NOT Y multisource_rel X', |
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1558 |
[('DeleteEntitiesStep', |
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1559 |
[('OneFetchStep', [('Any 999999 WHERE NOT Y multisource_rel 999999, Y is IN(Card, Note)', |
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1560 |
[{'Y': 'Card'}, {'Y': 'Note'}])], |
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1561 |
None, None, [self.system], {}, []) |
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1562 |
]) |
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1563 |
], |
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1564 |
{'x': 999999}) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1565 |
|
341
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1566 |
def test_delete_entity2(self): |
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1567 |
repo._type_source_cache[999999] = ('Note', 'system', 999999) |
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1568 |
self._test('DELETE Note X WHERE X eid %(x)s, NOT X multisource_inlined_rel Y', |
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1569 |
[('DeleteEntitiesStep', |
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1570 |
[('OneFetchStep', [('Any X WHERE X eid 999999, NOT X multisource_inlined_rel Y, X is Note, Y is IN(Affaire, Note)', |
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1571 |
[{'X': 'Note', 'Y': 'Affaire'}, {'X': 'Note', 'Y': 'Note'}])], |
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1572 |
None, None, [self.system], {}, []) |
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1573 |
]) |
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1574 |
], |
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1575 |
{'x': 999999}) |
0a426be2f3a2
fixes for some cases of neged inlined relations, may have to use (new) IntersectStep. XXX: write IntersectFetchStep
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
332
diff
changeset
|
1576 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1577 |
def test_update(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1578 |
self._test('SET X copain Y WHERE X login "comme", Y login "cochon"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1579 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1580 |
[('Any X WHERE X login "comme", X is EUser', [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1581 |
[self.ldap, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1582 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1583 |
[('Any Y WHERE Y login "cochon", Y is EUser', [{'Y': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1584 |
[self.ldap, self.system], None, {'Y': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1585 |
('UpdateStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1586 |
[('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1587 |
[('DISTINCT Any X,Y WHERE X is EUser, Y is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1588 |
[{'X': 'EUser', 'Y': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1589 |
None, None, [self.system], {'X': 'table0.C0', 'Y': 'table1.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1590 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1591 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1592 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1593 |
def test_update2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1594 |
self._test('SET U in_group G WHERE G name ~= "bougloup%", U login "admin"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1595 |
[('FetchStep', [('Any U WHERE U login "admin", U is EUser', [{'U': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1596 |
[self.ldap, self.system], None, {'U': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1597 |
('UpdateStep', [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1598 |
('OneFetchStep', [('DISTINCT Any U,G WHERE G name ILIKE "bougloup%", G is EGroup, U is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1599 |
[{'U': 'EUser', 'G': 'EGroup'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1600 |
None, None, [self.system], {'U': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1601 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1602 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1603 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1604 |
def test_update3(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1605 |
anoneid = self._user_session()[1].user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1606 |
# since we are adding a in_state relation for an entity in the system |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1607 |
# source, states should only be searched in the system source as well |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1608 |
self._test('SET X in_state S WHERE X eid %(x)s, S name "deactivated"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1609 |
[('UpdateStep', [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1610 |
('OneFetchStep', [('DISTINCT Any 5,S WHERE S name "deactivated", S is State', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1611 |
[{'S': 'State'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1612 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1613 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1614 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1615 |
{'x': anoneid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1616 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1617 |
# def test_update4(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1618 |
# # since we are adding a in_state relation with a state from the system |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1619 |
# # source, EUser should only be searched only in the system source as well |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1620 |
# rset = self.execute('State X WHERE X name "activated"') |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1621 |
# assert len(rset) == 1, rset |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1622 |
# activatedeid = rset[0][0] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1623 |
# self._test('SET X in_state S WHERE X is EUser, S eid %s' % activatedeid, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1624 |
# [('UpdateStep', [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1625 |
# ('OneFetchStep', [('DISTINCT Any X,%s WHERE X is EUser' % activatedeid, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1626 |
# [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1627 |
# None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1628 |
# ]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1629 |
# ]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1630 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1631 |
# non regression tests #################################################### |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1632 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1633 |
def test_nonregr1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1634 |
self._test('Any X, Y WHERE X copain Y, X login "syt", Y login "cochon"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1635 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1636 |
[('Any X WHERE X login "syt", X is EUser', [{'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1637 |
[self.ldap, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1638 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1639 |
[('Any Y WHERE Y login "cochon", Y is EUser', [{'Y': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1640 |
[self.ldap, self.system], None, {'Y': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1641 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1642 |
[('Any X,Y WHERE X copain Y, X is EUser, Y is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1643 |
[{'X': 'EUser', 'Y': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1644 |
None, None, [self.system], {'X': 'table0.C0', 'Y': 'table1.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1645 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1646 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1647 |
def test_nonregr2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1648 |
treid = self.session.user.latest_trinfo().eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1649 |
self._test('Any X ORDERBY D DESC WHERE E eid %(x)s, E wf_info_for X, X modification_date D', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1650 |
[('FetchStep', [('Any X,D WHERE X modification_date D, X is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1651 |
[{'X': 'Note', 'D': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1652 |
[self.rql, self.system], None, {'X': 'table0.C0', 'X.modification_date': 'table0.C1', 'D': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1653 |
('FetchStep', [('Any X,D WHERE X modification_date D, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1654 |
[{'X': 'EUser', 'D': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1655 |
[self.ldap, self.system], None, {'X': 'table1.C0', 'X.modification_date': 'table1.C1', 'D': 'table1.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1656 |
('AggrStep', 'Any X ORDERBY D DESC', None, None, 'table2', None, [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1657 |
('FetchStep', [('Any X,D WHERE E eid %s, E wf_info_for X, X modification_date D, E is TrInfo, X is Affaire'%treid, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1658 |
[{'X': 'Affaire', 'E': 'TrInfo', 'D': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1659 |
[self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1660 |
{}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1661 |
{'X': 'table2.C0', 'X.modification_date': 'table2.C1', 'D': 'table2.C1', 'E.wf_info_for': 'table2.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1662 |
('FetchStep', [('Any X,D WHERE E eid %s, E wf_info_for X, X modification_date D, E is TrInfo, X is EUser'%treid, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1663 |
[{'X': 'EUser', 'E': 'TrInfo', 'D': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1664 |
[self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1665 |
{'X': 'table1.C0', 'X.modification_date': 'table1.C1', 'D': 'table1.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1666 |
{'X': 'table2.C0', 'X.modification_date': 'table2.C1', 'D': 'table2.C1', 'E.wf_info_for': 'table2.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1667 |
('FetchStep', [('Any X,D WHERE E eid %s, E wf_info_for X, X modification_date D, E is TrInfo, X is Note'%treid, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1668 |
[{'X': 'Note', 'E': 'TrInfo', 'D': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1669 |
[self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1670 |
{'X': 'table0.C0', 'X.modification_date': 'table0.C1', 'D': 'table0.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1671 |
{'X': 'table2.C0', 'X.modification_date': 'table2.C1', 'D': 'table2.C1', 'E.wf_info_for': 'table2.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1672 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1673 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1674 |
{'x': treid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1675 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1676 |
def test_nonregr3(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1677 |
# original jpl query: |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1678 |
# Any X, NOW - CD, P WHERE P is Project, U interested_in P, U is EUser, U login "sthenault", X concerns P, X creation_date CD ORDERBY CD DESC LIMIT 5 |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1679 |
self._test('Any X, NOW - CD, P ORDERBY CD DESC LIMIT 5 WHERE P bookmarked_by U, U login "admin", P is X, X creation_date CD', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1680 |
[('FetchStep', [('Any U WHERE U login "admin", U is EUser', [{'U': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1681 |
[self.ldap, self.system], None, {'U': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1682 |
('OneFetchStep', [('Any X,(NOW - CD),P ORDERBY CD DESC LIMIT 5 WHERE P bookmarked_by U, P is X, X creation_date CD, P is Bookmark, U is EUser, X is EEType', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1683 |
[{'P': 'Bookmark', 'U': 'EUser', 'X': 'EEType', 'CD': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1684 |
5, None, [self.system], {'U': 'table0.C0'}, [])] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1685 |
) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1686 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1687 |
def test_nonregr4(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1688 |
self._test('Any U ORDERBY D DESC WHERE WF wf_info_for X, WF creation_date D, WF from_state FS, ' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1689 |
'WF owned_by U?, X eid %(x)s', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1690 |
[#('FetchStep', [('Any U WHERE U is EUser', [{'U': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1691 |
# [self.ldap, self.system], None, {'U': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1692 |
('OneFetchStep', [('Any U ORDERBY D DESC WHERE WF wf_info_for 5, WF creation_date D, WF from_state FS, WF owned_by U?', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1693 |
[{'WF': 'TrInfo', 'FS': 'State', 'U': 'EUser', 'D': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1694 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1695 |
[self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1696 |
{'x': self.session.user.eid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1697 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1698 |
def test_nonregr5(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1699 |
# original jpl query: |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1700 |
# DISTINCT Version V WHERE MB done_in MV, MV eid %(x)s, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1701 |
# MB depends_on B, B done_in V, V version_of P, NOT P eid %(p)s' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1702 |
cardeid = self.execute('INSERT Card X: X title "hop"')[0][0] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1703 |
noteeid = self.execute('INSERT Note X')[0][0] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1704 |
self._test('DISTINCT Card V WHERE MB documented_by MV, MV eid %(x)s, ' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1705 |
'MB depends_on B, B documented_by V, V multisource_rel P, NOT P eid %(p)s', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1706 |
[('FetchStep', [('Any V WHERE V multisource_rel P, NOT P eid %s, P is Note, V is Card'%noteeid, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1707 |
[{'P': 'Note', 'V': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1708 |
[self.rql, self.system], None, {'V': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1709 |
('OneFetchStep', [('DISTINCT Any V WHERE MB documented_by %s, MB depends_on B, B documented_by V, B is Affaire, MB is Affaire, V is Card'%cardeid, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1710 |
[{'B': 'Affaire', 'MB': 'Affaire', 'V': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1711 |
None, None, [self.system], {'V': 'table0.C0'}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1712 |
{'x': cardeid, 'p': noteeid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1713 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1714 |
def test_nonregr6(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1715 |
self._test('Any X WHERE X concerne Y', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1716 |
[('OneFetchStep', [('Any X WHERE X concerne Y', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1717 |
[{'Y': 'Division', 'X': 'Affaire'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1718 |
{'Y': 'Note', 'X': 'Affaire'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1719 |
{'Y': 'Societe', 'X': 'Affaire'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1720 |
{'Y': 'SubDivision', 'X': 'Affaire'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1721 |
{'Y': 'Affaire', 'X': 'Personne'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1722 |
None, None, [self.system], {}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1723 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1724 |
self._test('Any X WHERE X concerne Y, Y is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1725 |
[('FetchStep', [('Any Y WHERE Y is Note', [{'Y': 'Note'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1726 |
[self.rql, self.system], None, {'Y': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1727 |
('OneFetchStep', [('Any X WHERE X concerne Y, X is Affaire, Y is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1728 |
[{'X': 'Affaire', 'Y': 'Note'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1729 |
None, None, [self.system], {'Y': 'table0.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1730 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1731 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1732 |
def test_nonregr7(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1733 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1734 |
self._test('Any S,SUM(DUR),SUM(I),(SUM(I) - SUM(DUR)),MIN(DI),MAX(DI) GROUPBY S ORDERBY S WHERE A is Affaire, A duration DUR, A invoiced I, A modification_date DI, A in_state S, S name SN, (EXISTS(A concerne WP, W multisource_rel WP)) OR (EXISTS(A concerne W)), W eid %(n)s', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1735 |
[('FetchStep', [('Any WP WHERE 999999 multisource_rel WP, WP is Note', [{'WP': 'Note'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1736 |
[self.rql], None, {'WP': u'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1737 |
('OneFetchStep', [('Any S,SUM(DUR),SUM(I),(SUM(I) - SUM(DUR)),MIN(DI),MAX(DI) GROUPBY S ORDERBY S WHERE A duration DUR, A invoiced I, A modification_date DI, A in_state S, S name SN, (EXISTS(A concerne WP, WP is Note)) OR (EXISTS(A concerne 999999)), A is Affaire, S is State', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1738 |
[{'A': 'Affaire', 'DI': 'Datetime', 'DUR': 'Int', 'I': 'Int', 'S': 'State', 'SN': 'String', 'WP': 'Note'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1739 |
None, None, [self.system], {'WP': u'table0.C0'}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1740 |
{'n': 999999}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1741 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1742 |
def test_nonregr8(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1743 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1744 |
self._test('Any X,Z WHERE X eid %(x)s, X multisource_rel Y, Z concerne X', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1745 |
[('FetchStep', [('Any WHERE 999999 multisource_rel Y, Y is Note', [{'Y': 'Note'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1746 |
[self.rql], None, {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1747 |
('OneFetchStep', [('Any 999999,Z WHERE Z concerne 999999, Z is Affaire', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1748 |
[{'Z': 'Affaire'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1749 |
None, None, [self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1750 |
{'x': 999999}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1751 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1752 |
def test_nonregr9(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1753 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1754 |
repo._type_source_cache[999998] = ('Note', 'cards', 999998) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1755 |
self._test('SET X migrated_from Y WHERE X eid %(x)s, Y multisource_rel Z, Z eid %(z)s, Y migrated_from Z', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1756 |
[('FetchStep', [('Any Y WHERE Y multisource_rel 999998, Y is Note', [{'Y': 'Note'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1757 |
[self.rql], None, {'Y': u'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1758 |
('UpdateStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1759 |
[('OneFetchStep', [('DISTINCT Any 999999,Y WHERE Y migrated_from 999998, Y is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1760 |
[{'Y': 'Note'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1761 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1762 |
{'Y': u'table0.C0'}, [])])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1763 |
{'x': 999999, 'z': 999998}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1764 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1765 |
def test_nonregr10(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1766 |
repo._type_source_cache[999999] = ('EUser', 'ldapuser', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1767 |
self._test('Any X,AA,AB ORDERBY AA WHERE E eid %(x)s, E owned_by X, X login AA, X modification_date AB', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1768 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1769 |
[('Any X,AA,AB WHERE X login AA, X modification_date AB, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1770 |
[{'AA': 'String', 'AB': 'Datetime', 'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1771 |
[self.ldap], None, {'AA': 'table0.C1', 'AB': 'table0.C2', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1772 |
'X': 'table0.C0', 'X.login': 'table0.C1', 'X.modification_date': 'table0.C2'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1773 |
[]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1774 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1775 |
[('Any X,AA,AB ORDERBY AA WHERE 999999 owned_by X, X login AA, X modification_date AB, X is EUser', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1776 |
[{'AA': 'String', 'AB': 'Datetime', 'X': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1777 |
None, None, [self.system], {'AA': 'table0.C1', 'AB': 'table0.C2', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1778 |
'X': 'table0.C0', 'X.login': 'table0.C1', 'X.modification_date': 'table0.C2'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1779 |
[]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1780 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1781 |
{'x': 999999}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1782 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1783 |
def test_nonregr11(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1784 |
repo._type_source_cache[999999] = ('Bookmark', 'system', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1785 |
self._test('SET X bookmarked_by Y WHERE X eid %(x)s, Y login "hop"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1786 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1787 |
[('Any Y WHERE Y login "hop", Y is EUser', [{'Y': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1788 |
[self.ldap, self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1789 |
None, {'Y': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1790 |
('UpdateStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1791 |
[('OneFetchStep', [('DISTINCT Any 999999,Y WHERE Y is EUser', [{'Y': 'EUser'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1792 |
None, None, [self.system], {'Y': 'table0.C0'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1793 |
[])] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1794 |
)], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1795 |
{'x': 999999}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1796 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1797 |
def test_nonregr12(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1798 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1799 |
self._test('Any X ORDERBY Z DESC WHERE X modification_date Z, E eid %(x)s, E see_also X', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1800 |
[('FetchStep', [('Any X,Z WHERE X modification_date Z, X is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1801 |
[{'X': 'Note', 'Z': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1802 |
[self.rql], None, {'X': 'table0.C0', 'X.modification_date': 'table0.C1', 'Z': 'table0.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1803 |
[]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1804 |
('AggrStep', 'Any X ORDERBY Z DESC', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1805 |
None, None, 'table1', None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1806 |
[('FetchStep', [('Any X,Z WHERE X modification_date Z, 999999 see_also X, X is Bookmark', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1807 |
[{'X': 'Bookmark', 'Z': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1808 |
[self.system], {}, {'X': 'table1.C0', 'X.modification_date': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1809 |
'Z': 'table1.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1810 |
[]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1811 |
('FetchStep', [('Any X,Z WHERE X modification_date Z, 999999 see_also X, X is Note', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1812 |
[{'X': 'Note', 'Z': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1813 |
[self.system], {'X': 'table0.C0', 'X.modification_date': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1814 |
'Z': 'table0.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1815 |
{'X': 'table1.C0', 'X.modification_date': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1816 |
'Z': 'table1.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1817 |
[])] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1818 |
)], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1819 |
{'x': 999999}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1820 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1821 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1822 |
class MSPlannerTwoSameExternalSourcesTC(BasePlannerTC): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1823 |
"""test planner related feature on a 3-sources repository: |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1824 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1825 |
* 2 rql source supporting Card |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1826 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1827 |
repo = repo |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1828 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1829 |
def setUp(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1830 |
#_QuerierTC.setUp(self) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1831 |
self.o = repo.querier |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1832 |
self.session = repo._sessions.values()[0] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1833 |
self.pool = self.session.set_pool() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1834 |
self.schema = self.o.schema |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1835 |
self.sources = self.o._repo.sources |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1836 |
self.system = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1837 |
self.sources.append(FakeCardSource(self.o._repo, self.o.schema, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1838 |
{'uri': 'cards'})) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1839 |
repo.sources_by_uri['cards'] = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1840 |
self.rql = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1841 |
self.sources.append(FakeCardSource(self.o._repo, self.o.schema, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1842 |
{'uri': 'cards2'})) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1843 |
repo.sources_by_uri['cards2'] = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1844 |
self.rql2 = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1845 |
do_monkey_patch() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1846 |
self.planner = MSPlanner(self.o.schema, self.o._rqlhelper) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1847 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1848 |
_test = test_plan |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1849 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1850 |
def tearDown(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1851 |
undo_monkey_patch() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1852 |
del self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1853 |
del self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1854 |
del repo.sources_by_uri['cards'] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1855 |
del repo.sources_by_uri['cards2'] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1856 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1857 |
def test_linked_external_entities(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1858 |
repo._type_source_cache[999999] = ('Tag', 'system', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1859 |
self._test('Any X,XT WHERE X is Card, X title XT, T tags X, T eid %(t)s', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1860 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1861 |
[('Any X,XT WHERE X title XT, X is Card', [{'X': 'Card', 'XT': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1862 |
[self.rql, self.rql2, self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1863 |
None, {'X': 'table0.C0', 'X.title': 'table0.C1', 'XT': 'table0.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1864 |
[]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1865 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1866 |
[('Any X,XT WHERE X title XT, 999999 tags X, X is Card', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1867 |
[{'X': 'Card', 'XT': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1868 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1869 |
{'X': 'table0.C0', 'X.title': 'table0.C1', 'XT': 'table0.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1870 |
[])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1871 |
{'t': 999999}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1872 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1873 |
if __name__ == '__main__': |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1874 |
from logilab.common.testlib import unittest_main |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1875 |
unittest_main() |