author | sylvain.thenault@logilab.fr |
Wed, 29 Apr 2009 09:03:31 +0200 | |
branch | tls-sprint |
changeset 1530 | 849fd3d64f11 |
parent 1398 | 5fe84a5f7035 |
child 1785 | 01245e2a777d |
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' |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
22 |
support_entities = {'CWUser': False} |
332
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'}, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
41 |
{'X': 'CWCache'}, {'X': 'CWConstraint'}, {'X': 'CWConstraintType'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
42 |
{'X': 'CWEType'}, {'X': 'CWAttribute'}, {'X': 'CWGroup'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
43 |
{'X': 'CWRelation'}, {'X': 'CWPermission'}, {'X': 'CWProperty'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
44 |
{'X': 'CWRType'}, {'X': 'CWUser'}, {'X': 'Email'}, |
332
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 |
|
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
51 |
def clear_ms_caches(repo): |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
52 |
clear_cache(repo, 'rel_type_sources') |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
53 |
clear_cache(repo, 'can_cross_relation') |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
54 |
clear_cache(repo, 'is_multi_sources_relation') |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
55 |
# XXX source_defs |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
56 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
57 |
# 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
|
58 |
repo, cnx = init_test_database('sqlite') |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
59 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
60 |
class BaseMSPlannerTC(BasePlannerTC): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
61 |
"""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
|
62 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
63 |
* system source supporting everything |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
64 |
* ldap source supporting CWUser |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
65 |
* rql source supporting Card |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
66 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
67 |
repo = repo |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
68 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
69 |
def setUp(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
70 |
#_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
|
71 |
clear_cache(repo, 'rel_type_sources') |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
72 |
self.o = repo.querier |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
73 |
self.session = repo._sessions.values()[0] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
74 |
self.pool = self.session.set_pool() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
75 |
self.schema = self.o.schema |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
76 |
# hijack Affaire security |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
77 |
affreadperms = list(self.schema['Affaire']._groups['read']) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
78 |
self.prevrqlexpr_affaire = affreadperms[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
79 |
# 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
|
80 |
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
|
81 |
self.schema['Affaire']._groups['read'] = tuple(affreadperms) |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
82 |
# hijack CWUser security |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
83 |
userreadperms = list(self.schema['CWUser']._groups['read']) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
84 |
self.prevrqlexpr_user = userreadperms[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
85 |
userreadperms[-1] = ERQLExpression('X owned_by U') |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
86 |
self.schema['CWUser']._groups['read'] = tuple(userreadperms) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
87 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
88 |
self.sources = self.o._repo.sources |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
89 |
self.system = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
90 |
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
|
91 |
{'uri': 'ldapuser'})) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
92 |
repo.sources_by_uri['ldapuser'] = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
93 |
self.ldap = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
94 |
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
|
95 |
{'uri': 'cards'})) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
96 |
repo.sources_by_uri['cards'] = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
97 |
self.rql = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
98 |
do_monkey_patch() |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
99 |
clear_ms_caches(repo) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
100 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
101 |
def tearDown(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
102 |
undo_monkey_patch() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
103 |
del self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
104 |
del self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
105 |
del repo.sources_by_uri['ldapuser'] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
106 |
del repo.sources_by_uri['cards'] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
107 |
# restore hijacked security |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
108 |
self.restore_orig_affaire_security() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
109 |
self.restore_orig_euser_security() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
110 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
111 |
def restore_orig_affaire_security(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
112 |
affreadperms = list(self.schema['Affaire']._groups['read']) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
113 |
affreadperms[-1] = self.prevrqlexpr_affaire |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
114 |
self.schema['Affaire']._groups['read'] = tuple(affreadperms) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
115 |
clear_cache(self.schema['Affaire'], 'ERSchema_get_rqlexprs') |
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 |
def restore_orig_euser_security(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
118 |
userreadperms = list(self.schema['CWUser']._groups['read']) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
119 |
userreadperms[-1] = self.prevrqlexpr_user |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
120 |
self.schema['CWUser']._groups['read'] = tuple(userreadperms) |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
121 |
clear_cache(self.schema['CWUser'], 'ERSchema_get_rqlexprs') |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
122 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
123 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
124 |
class PartPlanInformationTC(BaseMSPlannerTC): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
125 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
126 |
def _test(self, rql, *args): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
127 |
if len(args) == 3: |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
128 |
kwargs, sourcesterms, needsplit = args |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
129 |
else: |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
130 |
sourcesterms, needsplit = args |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
131 |
kwargs = None |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
132 |
plan = self._prepare_plan(rql, kwargs) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
133 |
union = plan.rqlst |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
134 |
plan.preprocess(union) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
135 |
ppi = PartPlanInformation(plan, union.children[0]) |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
136 |
for sourcevars in ppi._sourcesterms.itervalues(): |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
137 |
for var in sourcevars.keys(): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
138 |
solindices = sourcevars.pop(var) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
139 |
sourcevars[var._ms_table_key()] = solindices |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
140 |
self.assertEquals(ppi._sourcesterms, sourcesterms) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
141 |
self.assertEquals(ppi.needsplit, needsplit) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
142 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
143 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
144 |
def test_simple_system_only(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
145 |
"""retrieve entities only supported by the system source""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
146 |
self._test('CWGroup X', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
147 |
{self.system: {'X': s[0]}}, False) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
148 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
149 |
def test_simple_system_ldap(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
150 |
"""retrieve CWUser X from both sources and return concatenation of results |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
151 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
152 |
self._test('CWUser X', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
153 |
{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
|
154 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
155 |
def test_simple_system_rql(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
156 |
"""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
|
157 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
158 |
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
|
159 |
{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
|
160 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
161 |
def test_simple_eid_specified(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
162 |
"""retrieve CWUser X from system source (eid is specified, can locate the entity) |
332
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,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
|
166 |
{self.system: {'X': s[0]}}, 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_eid_invariant(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
169 |
"""retrieve CWUser X from system source (eid is specified, can locate the entity) |
332
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 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
172 |
self._test('Any X WHERE X eid %(x)s', {'x': ueid}, |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
173 |
{self.system: {'x': s[0]}}, False) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
174 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
175 |
def test_simple_invariant(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
176 |
"""retrieve CWUser X from system source only (X is invariant and in_group not supported by ldap source) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
177 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
178 |
self._test('Any X WHERE X is CWUser, X in_group G, G name "users"', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
179 |
{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
|
180 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
181 |
def test_security_has_text(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
182 |
"""retrieve CWUser X from system source only (has_text not supported by ldap source) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
183 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
184 |
# specify CWUser instead of any since the way this test is written we aren't well dealing |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
185 |
# with ambigous query (eg only considering the first solution) |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
186 |
self._test('CWUser X WHERE X has_text "bla"', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
187 |
{self.system: {'X': s[0]}}, False) |
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 |
def test_complex_base(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
190 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
191 |
1. retrieve Any X, L WHERE X is CWUser, X login L from system and ldap sources, store |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
192 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
193 |
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
|
194 |
G name 'users' on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
195 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
196 |
self._test('Any X,L WHERE X is CWUser, X in_group G, X login L, G name "users"', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
197 |
{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
|
198 |
self.ldap : {'X': s[0]}}, True) |
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 |
def test_complex_invariant_ordered(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
201 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
202 |
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
|
203 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
204 |
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
|
205 |
on the system source |
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 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
208 |
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
|
209 |
{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
|
210 |
self.ldap : {'X': s[0]}}, True) |
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 |
def test_complex_invariant(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
213 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
214 |
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
|
215 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
216 |
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
|
217 |
on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
218 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
219 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
220 |
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
|
221 |
{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
|
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_ambigous(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
225 |
"""retrieve CWUser X from system and ldap sources, Person X from system source only |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
226 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
227 |
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
|
228 |
{self.system: {'X': s[0, 1]}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
229 |
self.ldap: {'X': s[0]}}, True) |
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 |
def test_complex_multiple(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
232 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
233 |
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
|
234 |
cartesian product of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
235 |
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
|
236 |
on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
237 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
238 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
239 |
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
|
240 |
{self.system: {'Y': s[0], 'X': s[0]}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
241 |
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
|
242 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
243 |
def test_complex_aggregat(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
244 |
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
|
245 |
self._test('Any MAX(X)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
246 |
{self.system: {'X': solindexes}}, False) |
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 |
def test_complex_optional(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
249 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
250 |
self._test('Any U WHERE WF wf_info_for X, X eid %(x)s, WF owned_by U?, WF from_state FS', {'x': ueid}, |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
251 |
{self.system: {'WF': s[0], 'FS': s[0], 'U': s[0], |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
252 |
'from_state': s[0], 'owned_by': s[0], 'wf_info_for': s[0], |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
253 |
'x': s[0]}}, |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
254 |
False) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
255 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
256 |
def test_exists4(self): |
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 |
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
|
259 |
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
|
260 |
{self.rql : 'S'} must be removed |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
261 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
262 |
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
|
263 |
'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
|
264 |
'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
|
265 |
{self.system: {'X': s[0], 'S': s[0], 'T2': s[0], 'T': s[0], 'G': s[0], 'copain': s[0], 'in_group': s[0]}, |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
266 |
self.ldap: {'X': s[0], 'T2': s[0], 'T': s[0]}}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
267 |
True) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
268 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
269 |
def test_relation_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
270 |
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
|
271 |
{self.system: {'X': s[0, 1, 2], 'S': s[0, 1, 2]}, |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
272 |
self.rql: {'X': s[2], 'S': s[2]}}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
273 |
True) |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
274 |
|
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
275 |
def test_not_relation_need_split(self): |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
276 |
self._test('Any SN WHERE NOT X in_state S, S name SN', |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
277 |
{self.rql: {'X': s[2], 'S': s[0, 1, 2]}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
278 |
self.system: {'X': s[0, 1, 2], 'S': s[0, 1, 2]}}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
279 |
True) |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
280 |
|
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
281 |
def test_not_relation_no_split_external(self): |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
282 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
283 |
# similar to the above test but with an eid coming from the external source. |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
284 |
# the same plan may be used, since we won't find any record in the system source |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
285 |
# linking 9999999 to a state |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
286 |
self._test('Any SN WHERE NOT X in_state S, X eid %(x)s, S name SN', |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
287 |
{'x': 999999}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
288 |
{self.rql: {'x': s[0], 'S': s[0]}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
289 |
self.system: {'x': s[0], 'S': s[0]}}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
290 |
False) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
291 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
292 |
def test_relation_restriction_ambigous_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
293 |
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
|
294 |
{self.system: {'X': s[0, 1, 2], 'S': s[0, 1, 2], 'T': s[0, 1, 2], 'tags': s[0, 1, 2]}, |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
295 |
self.rql: {'X': s[2], 'S': s[2]}}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
296 |
True) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
297 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
298 |
def test_simplified_var(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
299 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
300 |
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
|
301 |
{'x': 999999, 'u': self.session.user.eid}, |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
302 |
{self.system: {'P': s[0], 'G': s[0], 'X': s[0], |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
303 |
'require_permission': s[0], 'in_group': s[0], 'P': s[0], 'require_group': s[0], |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
304 |
'u': s[0]}}, |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
305 |
False) |
332
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 |
def test_delete_relation1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
308 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
309 |
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
|
310 |
{'x': ueid, 'y': ueid}, |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
311 |
{self.system: {'Y': s[0], 'created_by': s[0], 'x': s[0]}}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
312 |
False) |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
313 |
|
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
314 |
def test_crossed_relation_eid_1_needattr(self): |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
315 |
repo._type_source_cache[999999] = ('Note', 'system', 999999) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
316 |
ueid = self.session.user.eid |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
317 |
self._test('Any Y,T WHERE X eid %(x)s, X multisource_crossed_rel Y, Y type T', |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
318 |
{'x': 999999,}, |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
319 |
{self.rql: {'Y': s[0]}, self.system: {'Y': s[0], 'x': s[0]}}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
320 |
True) |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
321 |
|
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
322 |
def test_crossed_relation_eid_1_invariant(self): |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
323 |
repo._type_source_cache[999999] = ('Note', 'system', 999999) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
324 |
self._test('Any Y WHERE X eid %(x)s, X multisource_crossed_rel Y', |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
325 |
{'x': 999999}, |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
326 |
{self.system: {'Y': s[0], 'x': s[0]}}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
327 |
False) |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
328 |
|
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
329 |
def test_crossed_relation_eid_2_invariant(self): |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
330 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
331 |
self._test('Any Y WHERE X eid %(x)s, X multisource_crossed_rel Y', |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
332 |
{'x': 999999,}, |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
333 |
{self.rql: {'Y': s[0], 'multisource_crossed_rel': s[0], 'x': s[0]}, |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
334 |
self.system: {'Y': s[0], 'multisource_crossed_rel': s[0], 'x': s[0]}}, |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
335 |
False) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
336 |
|
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
337 |
def test_version_crossed_depends_on_1(self): |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
338 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
339 |
self._test('Any X,AD,AE WHERE E eid %(x)s, E multisource_crossed_rel X, X in_state AD, AD name AE', |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
340 |
{'x': 999999}, |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
341 |
{self.rql: {'X': s[0], 'AD': s[0], 'multisource_crossed_rel': s[0], 'x': s[0]}, |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
342 |
self.system: {'X': s[0], 'AD': s[0], 'multisource_crossed_rel': s[0], 'x': s[0]}}, |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
343 |
True) |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
344 |
|
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
345 |
def test_version_crossed_depends_on_2(self): |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
346 |
repo._type_source_cache[999999] = ('Note', 'system', 999999) |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
347 |
self._test('Any X,AD,AE WHERE E eid %(x)s, E multisource_crossed_rel X, X in_state AD, AD name AE', |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
348 |
{'x': 999999}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
349 |
{self.rql: {'X': s[0], 'AD': s[0]}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
350 |
self.system: {'X': s[0], 'AD': s[0], 'x': s[0]}}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
351 |
True) |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
352 |
|
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
353 |
def test_simplified_var_3(self): |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
354 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
355 |
repo._type_source_cache[999998] = ('State', 'cards', 999998) |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
356 |
self._test('Any S,T WHERE S eid %(s)s, N eid %(n)s, N type T, N is Note, S is State', |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
357 |
{'n': 999999, 's': 999998}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
358 |
{self.rql: {'s': s[0], 'N': s[0]}}, False) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
359 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
360 |
|
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 |
class MSPlannerTC(BaseMSPlannerTC): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
363 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
364 |
def setUp(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
365 |
BaseMSPlannerTC.setUp(self) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
366 |
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
|
367 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
368 |
_test = test_plan |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
369 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
370 |
def test_simple_system_only(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
371 |
"""retrieve entities only supported by the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
372 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
373 |
self._test('CWGroup X', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
374 |
[('OneFetchStep', [('Any X WHERE X is CWGroup', [{'X': 'CWGroup'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
375 |
None, None, [self.system], {}, [])]) |
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_system_only_limit(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
378 |
"""retrieve entities only supported by the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
379 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
380 |
self._test('CWGroup X LIMIT 10', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
381 |
[('OneFetchStep', [('Any X LIMIT 10 WHERE X is CWGroup', [{'X': 'CWGroup'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
382 |
10, None, [self.system], {}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
383 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
384 |
def test_simple_system_only_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
385 |
"""retrieve entities only supported by the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
386 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
387 |
self._test('CWGroup X LIMIT 10 OFFSET 10', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
388 |
[('OneFetchStep', [('Any X LIMIT 10 OFFSET 10 WHERE X is CWGroup', [{'X': 'CWGroup'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
389 |
10, 10, [self.system], {}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
390 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
391 |
def test_simple_system_ldap(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
392 |
"""retrieve CWUser X from both sources and return concatenation of results |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
393 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
394 |
self._test('CWUser X', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
395 |
[('OneFetchStep', [('Any X WHERE X is CWUser', [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
396 |
None, None, [self.ldap, self.system], {}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
397 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
398 |
def test_simple_system_ldap_limit(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
399 |
"""retrieve CWUser X from both sources and return concatenation of results |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
400 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
401 |
self._test('CWUser X LIMIT 10', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
402 |
[('OneFetchStep', [('Any X LIMIT 10 WHERE X is CWUser', [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
403 |
10, None, [self.ldap, self.system], {}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
404 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
405 |
def test_simple_system_ldap_limit_offset(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
406 |
"""retrieve CWUser X from both sources and return concatenation of results |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
407 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
408 |
self._test('CWUser X LIMIT 10 OFFSET 10', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
409 |
[('OneFetchStep', [('Any X LIMIT 10 OFFSET 10 WHERE X is CWUser', [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
410 |
10, 10, [self.ldap, self.system], {}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
411 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
412 |
def test_simple_system_ldap_ordered_limit_offset(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
413 |
"""retrieve CWUser X from both sources and return concatenation of results |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
414 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
415 |
self._test('CWUser X ORDERBY X LIMIT 10 OFFSET 10', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
416 |
[('AggrStep', 'Any X ORDERBY X', 10, 10, 'table0', None, [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
417 |
('FetchStep', [('Any X WHERE X is CWUser', [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
418 |
[self.ldap, self.system], {}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
419 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
420 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
421 |
def test_simple_system_ldap_aggregat(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
422 |
"""retrieve CWUser X from both sources and return concatenation of results |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
423 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
424 |
# COUNT(X) is kept in sub-step and transformed into SUM(X) in the AggrStep |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
425 |
self._test('Any COUNT(X) WHERE X is CWUser', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
426 |
[('AggrStep', 'Any COUNT(X)', None, None, 'table0', None, [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
427 |
('FetchStep', [('Any COUNT(X) WHERE X is CWUser', [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
428 |
[self.ldap, self.system], {}, {'COUNT(X)': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
429 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
430 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
431 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
432 |
def test_simple_system_rql(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
433 |
"""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
|
434 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
435 |
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
|
436 |
[('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
|
437 |
None, None, [self.rql, self.system], {}, [])]) |
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 |
def test_simple_eid_specified(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
440 |
"""retrieve CWUser X from system source (eid is specified, can locate the entity) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
441 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
442 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
443 |
self._test('Any X,L WHERE X eid %(x)s, X login L', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
444 |
[('OneFetchStep', [('Any X,L WHERE X eid %s, X login L'%ueid, [{'X': 'CWUser', 'L': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
445 |
None, None, [self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
446 |
{'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
447 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
448 |
def test_simple_eid_invariant(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
449 |
"""retrieve CWUser X from system source (eid is specified, can locate the entity) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
450 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
451 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
452 |
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
|
453 |
[('OneFetchStep', [('Any %s'%ueid, [{}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
454 |
None, None, [self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
455 |
{'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
456 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
457 |
def test_simple_invariant(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
458 |
"""retrieve CWUser X from system source only (X is invariant and in_group not supported by ldap source) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
459 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
460 |
self._test('Any X WHERE X is CWUser, X in_group G, G name "users"', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
461 |
[('OneFetchStep', [('Any X WHERE X is CWUser, X in_group G, G name "users"', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
462 |
[{'X': 'CWUser', 'G': 'CWGroup'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
463 |
None, None, [self.system], {}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
464 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
465 |
def test_complex_base(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
466 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
467 |
1. retrieve Any X, L WHERE X is CWUser, X login L from system and ldap sources, store |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
468 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
469 |
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
|
470 |
G name 'users' on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
471 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
472 |
self._test('Any X,L WHERE X is CWUser, X in_group G, X login L, G name "users"', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
473 |
[('FetchStep', [('Any X,L WHERE X login L, X is CWUser', [{'X': 'CWUser', 'L': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
474 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
475 |
{'X': 'table0.C0', 'X.login': 'table0.C1', 'L': 'table0.C1'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
476 |
('OneFetchStep', [('Any X,L WHERE X in_group G, X login L, G name "users", G is CWGroup, X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
477 |
[{'X': 'CWUser', 'L': 'String', 'G': 'CWGroup'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
478 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
479 |
{'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
|
480 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
481 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
482 |
def test_complex_base_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
483 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
484 |
1. retrieve Any X, L WHERE X is CWUser, X login L from system and ldap sources, store |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
485 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
486 |
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
|
487 |
G name 'users' on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
488 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
489 |
self._test('Any X,L LIMIT 10 OFFSET 10 WHERE X is CWUser, X in_group G, X login L, G name "users"', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
490 |
[('FetchStep', [('Any X,L WHERE X login L, X is CWUser', [{'X': 'CWUser', 'L': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
491 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
492 |
{'X': 'table0.C0', 'X.login': 'table0.C1', 'L': 'table0.C1'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
493 |
('OneFetchStep', [('Any X,L LIMIT 10 OFFSET 10 WHERE X in_group G, X login L, G name "users", G is CWGroup, X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
494 |
[{'X': 'CWUser', 'L': 'String', 'G': 'CWGroup'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
495 |
10, 10, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
496 |
[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
|
497 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
498 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
499 |
def test_complex_ordered(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
500 |
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
|
501 |
[('AggrStep', 'Any L ORDERBY L', None, None, 'table0', None, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
502 |
[('FetchStep', [('Any L WHERE X login L, X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
503 |
[{'X': 'CWUser', 'L': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
504 |
[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
|
505 |
]) |
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 |
def test_complex_ordered_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
509 |
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
|
510 |
[('AggrStep', 'Any L ORDERBY L', 10, 10, 'table0', None, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
511 |
[('FetchStep', [('Any L WHERE X login L, X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
512 |
[{'X': 'CWUser', 'L': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
513 |
[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
|
514 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
515 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
516 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
517 |
def test_complex_invariant_ordered(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
518 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
519 |
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
|
520 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
521 |
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
|
522 |
on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
523 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
524 |
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
|
525 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
526 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
527 |
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
|
528 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
529 |
[('Any X,AA WHERE X modification_date AA, X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
530 |
[{'AA': 'Datetime', 'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
531 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
532 |
{'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
|
533 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
534 |
[('Any X,AA ORDERBY AA WHERE 5 owned_by X, X modification_date AA, X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
535 |
[{'AA': 'Datetime', 'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
536 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
537 |
{'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
|
538 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
539 |
{'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
540 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
541 |
def test_complex_invariant(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
542 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
543 |
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
|
544 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
545 |
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
|
546 |
on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
547 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
548 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
549 |
self._test('Any X,L,AA WHERE E eid %(x)s, E owned_by X, X login L, X modification_date AA', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
550 |
[('FetchStep', [('Any X,L,AA WHERE X login L, X modification_date AA, X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
551 |
[{'AA': 'Datetime', 'X': 'CWUser', 'L': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
552 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
553 |
{'AA': 'table0.C2', 'X': 'table0.C0', 'X.login': 'table0.C1', 'X.modification_date': 'table0.C2', 'L': 'table0.C1'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
554 |
('OneFetchStep', [('Any X,L,AA WHERE %s owned_by X, X login L, X modification_date AA, X is CWUser'%ueid, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
555 |
[{'AA': 'Datetime', 'X': 'CWUser', 'L': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
556 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
557 |
{'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
|
558 |
{'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
559 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
560 |
def test_complex_ambigous(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
561 |
"""retrieve CWUser X from system and ldap sources, Person X from system source only |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
562 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
563 |
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
|
564 |
[('UnionStep', None, None, [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
565 |
('OneFetchStep', [('Any X,F WHERE X firstname F, X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
566 |
[{'X': 'CWUser', 'F': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
567 |
None, None, [self.ldap, self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
568 |
('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
|
569 |
[{'X': 'Personne', 'F': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
570 |
None, None, [self.system], {}, []), |
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 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
573 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
574 |
def test_complex_ambigous_limit_offset(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
575 |
"""retrieve CWUser X from system and ldap sources, Person X from system source only |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
576 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
577 |
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
|
578 |
[('UnionStep', 10, 10, [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
579 |
('OneFetchStep', [('Any X,F WHERE X firstname F, X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
580 |
[{'X': 'CWUser', 'F': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
581 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
582 |
[self.ldap, self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
583 |
('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
|
584 |
[{'X': 'Personne', 'F': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
585 |
None, None, [self.system], {}, []), |
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 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
589 |
def test_complex_ambigous_ordered(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
590 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
591 |
1. retrieve CWUser X from system and ldap sources, Person X from system source only, store |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
592 |
each result in the same temp table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
593 |
2. return content of the table sorted |
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 |
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
|
596 |
[('AggrStep', 'Any X,F ORDERBY F', None, None, 'table0', None, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
597 |
[('FetchStep', [('Any X,F WHERE X firstname F, X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
598 |
[{'X': 'CWUser', 'F': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
599 |
[self.ldap, self.system], {}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
600 |
{'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
|
601 |
('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
|
602 |
[{'X': 'Personne', 'F': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
603 |
[self.system], {}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
604 |
{'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
|
605 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
606 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
607 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
608 |
def test_complex_multiple(self): |
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 |
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
|
611 |
cartesian product of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
612 |
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
|
613 |
on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
614 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
615 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
616 |
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
|
617 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
618 |
[('Any X WHERE X login "syt", X is CWUser', [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
619 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
620 |
{'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
621 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
622 |
[('Any Y WHERE Y login "adim", Y is CWUser', [{'Y': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
623 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
624 |
{'Y': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
625 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
626 |
[('Any X,Y WHERE X is CWUser, Y is CWUser', [{'X': 'CWUser', 'Y': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
627 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
628 |
{'X': 'table0.C0', 'Y': 'table1.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
629 |
], {'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
630 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
631 |
def test_complex_multiple_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
632 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
633 |
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
|
634 |
cartesian product of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
635 |
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
|
636 |
on the system source |
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 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
639 |
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
|
640 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
641 |
[('Any X WHERE X login "syt", X is CWUser', [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
642 |
[self.ldap, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
643 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
644 |
[('Any Y WHERE Y login "adim", Y is CWUser', [{'Y': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
645 |
[self.ldap, self.system], None, {'Y': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
646 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
647 |
[('Any X,Y LIMIT 10 OFFSET 10 WHERE X is CWUser, Y is CWUser', [{'X': 'CWUser', 'Y': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
648 |
10, 10, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
649 |
{'X': 'table0.C0', 'Y': 'table1.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
650 |
], {'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
651 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
652 |
def test_complex_aggregat(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
653 |
self._test('Any MAX(X)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
654 |
[('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
655 |
[('Any MAX(X)', X_ALL_SOLS)], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
656 |
None, None, [self.system], {}, []) |
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 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
659 |
def test_complex_typed_aggregat(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
660 |
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
|
661 |
[('AggrStep', 'Any MAX(X)', None, None, 'table0', None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
662 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
663 |
[('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
|
664 |
[self.rql, self.system], {}, {'MAX(X)': 'table0.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
665 |
]) |
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_complex_greater_eid(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
669 |
self._test('Any X WHERE X eid > 12', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
670 |
[('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
671 |
[('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
|
672 |
None, None, [self.system], {}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
673 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
674 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
675 |
def test_complex_greater_typed_eid(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
676 |
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
|
677 |
[('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
678 |
[('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
|
679 |
None, None, [self.system], {}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
680 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
681 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
682 |
def test_complex_optional(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
683 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
684 |
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
|
685 |
[('OneFetchStep', [('Any U WHERE WF wf_info_for 5, WF owned_by U?, WF from_state FS', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
686 |
[{'WF': 'TrInfo', 'FS': 'State', 'U': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
687 |
None, None, [self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
688 |
{'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
689 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
690 |
def test_complex_optional(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
691 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
692 |
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
|
693 |
[('OneFetchStep', [('Any U WHERE WF wf_info_for 5, WF owned_by U?, WF from_state FS', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
694 |
[{'WF': 'TrInfo', 'FS': 'State', 'U': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
695 |
None, None, [self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
696 |
{'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
697 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
698 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
699 |
def test_3sources_ambigous(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
700 |
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
|
701 |
[('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
|
702 |
[self.rql, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
703 |
{'T': 'table0.C1', 'X': 'table0.C0', 'X.title': 'table0.C1'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
704 |
('FetchStep', [('Any U WHERE U login "syt", U is CWUser', [{'U': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
705 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
706 |
{'U': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
707 |
('UnionStep', None, None, [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
708 |
('OneFetchStep', [('Any X,T WHERE X owned_by U, X title T, U is CWUser, X is IN(Bookmark, EmailThread)', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
709 |
[{'T': 'String', 'U': 'CWUser', 'X': 'Bookmark'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
710 |
{'T': 'String', 'U': 'CWUser', 'X': 'EmailThread'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
711 |
None, None, [self.system], {'U': 'table1.C0'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
712 |
('OneFetchStep', [('Any X,T WHERE X owned_by U, X title T, U is CWUser, X is Card', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
713 |
[{'X': 'Card', 'U': 'CWUser', 'T': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
714 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
715 |
{'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
|
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_restricted_max(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
720 |
# 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
|
721 |
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
|
722 |
'(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
|
723 |
'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
|
724 |
[('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
|
725 |
[{'X': 'Card', 'VR': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
726 |
[self.rql, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
727 |
{'VR': 'table0.C0', 'X.creation_date': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
728 |
('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
|
729 |
[{'VR': 'Datetime', 'V': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
730 |
[self.rql, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
731 |
{'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
|
732 |
('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
|
733 |
[{'X': 'Card', 'VR': 'Datetime', 'V': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
734 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
735 |
{'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
|
736 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
737 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
738 |
def test_outer_supported_rel1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
739 |
# 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
|
740 |
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
|
741 |
'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
|
742 |
[('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
|
743 |
[{'Y': 'Note', 'X': 'Note', 'S': 'State', 'R': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
744 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
745 |
[self.rql, self.system], {}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
746 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
747 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
748 |
def test_not_identity(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
749 |
# 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
|
750 |
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
|
751 |
[('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
752 |
[('Any X WHERE NOT X identity 5, X is CWUser', [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
753 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
754 |
[self.ldap, self.system], {}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
755 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
756 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
757 |
def test_outer_supported_rel2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
758 |
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
|
759 |
'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
|
760 |
[('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
|
761 |
[{'Y': 'Note', 'A': 'State', 'R': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
762 |
[self.rql, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
763 |
{'A': 'table0.C0', 'R': 'table0.C1', 'Y.type': 'table0.C1'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
764 |
('FetchStep', [('Any X,R WHERE X login R, X is CWUser', [{'X': 'CWUser', 'R': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
765 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
766 |
{'X': 'table1.C0', 'X.login': 'table1.C1', 'R': 'table1.C1'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
767 |
('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 CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
768 |
[{'Y': 'Note', 'X': 'CWUser', 'S': 'State', 'R': 'String', 'A': 'State'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
769 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
770 |
{'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
|
771 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
772 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
773 |
def test_security_has_text(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
774 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
775 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
776 |
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
|
777 |
[('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
|
778 |
[self.rql, self.system], None, {'E': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
779 |
('UnionStep', None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
780 |
[('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
781 |
[(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
|
782 |
[{'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
|
783 |
None, None, [self.system], {'E': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
784 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
785 |
[('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
|
786 |
[{'X': 'Basket'}]), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
787 |
('Any X WHERE X has_text "bla", EXISTS(X owned_by 5), X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
788 |
[{'X': 'CWUser'}]), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
789 |
('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
|
790 |
[{'X': 'Card'}, {'X': 'Comment'}, {'X': 'Division'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
791 |
{'X': 'Email'}, {'X': 'EmailThread'}, {'X': 'File'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
792 |
{'X': 'Folder'}, {'X': 'Image'}, {'X': 'Note'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
793 |
{'X': 'Personne'}, {'X': 'Societe'}, {'X': 'State'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
794 |
{'X': 'SubDivision'}, {'X': 'Tag'}, {'X': 'Transition'}]),], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
795 |
None, None, [self.system], {}, []), |
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 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
798 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
799 |
def test_security_has_text_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
800 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
801 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
802 |
# 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
|
803 |
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
|
804 |
[('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
|
805 |
[self.rql, self.system], None, {'E': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
806 |
('UnionFetchStep', [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
807 |
('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
|
808 |
[{'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
|
809 |
[self.system], {'E': 'table1.C0'}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
810 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
811 |
[('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
|
812 |
[{'X': 'Basket'}]), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
813 |
('Any X WHERE X has_text "bla", EXISTS(X owned_by 5), X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
814 |
[{'X': 'CWUser'}]), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
815 |
('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
|
816 |
[{'X': 'Card'}, {'X': 'Comment'}, {'X': 'Division'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
817 |
{'X': 'Email'}, {'X': 'EmailThread'}, {'X': 'File'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
818 |
{'X': 'Folder'}, {'X': 'Image'}, {'X': 'Note'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
819 |
{'X': 'Personne'}, {'X': 'Societe'}, {'X': 'State'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
820 |
{'X': 'SubDivision'}, {'X': 'Tag'}, {'X': 'Transition'}]),], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
821 |
[self.system], {}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
822 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
823 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
824 |
[('Any X LIMIT 10 OFFSET 10', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
825 |
[{'X': 'Affaire'}, {'X': 'Basket'}, {'X': 'Card'}, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
826 |
{'X': 'Comment'}, {'X': 'Division'}, {'X': 'CWUser'}, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
827 |
{'X': 'Email'}, {'X': 'EmailThread'}, {'X': 'File'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
828 |
{'X': 'Folder'}, {'X': 'Image'}, {'X': 'Note'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
829 |
{'X': 'Personne'}, {'X': 'Societe'}, {'X': 'State'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
830 |
{'X': 'SubDivision'}, {'X': 'Tag'}, {'X': 'Transition'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
831 |
10, 10, [self.system], {'X': 'table0.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
832 |
]) |
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 |
def test_security_user(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
835 |
"""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
|
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 X WHERE X login "bla"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
839 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
840 |
[('Any X WHERE X login "bla", X is CWUser', [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
841 |
[self.ldap, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
842 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
843 |
[('Any X WHERE EXISTS(X owned_by 5), X is CWUser', [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
844 |
None, None, [self.system], {'X': 'table0.C0'}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
845 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
846 |
def test_security_complex_has_text(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
847 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
848 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
849 |
self._test('Any X WHERE X has_text "bla", X firstname "bla"', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
850 |
[('FetchStep', [('Any X WHERE X firstname "bla", X is CWUser', [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
851 |
[self.ldap, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
852 |
('UnionStep', None, None, [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
853 |
('OneFetchStep', [('Any X WHERE X has_text "bla", EXISTS(X owned_by 5), X is CWUser', [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
854 |
None, None, [self.system], {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
855 |
('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
|
856 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
857 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
858 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
859 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
860 |
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
|
861 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
862 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
863 |
self._test('Any X LIMIT 10 OFFSET 10 WHERE X has_text "bla", X firstname "bla"', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
864 |
[('FetchStep', [('Any X WHERE X firstname "bla", X is CWUser', [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
865 |
[self.ldap, self.system], None, {'X': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
866 |
('UnionFetchStep', [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
867 |
('FetchStep', [('Any X WHERE X has_text "bla", EXISTS(X owned_by 5), X is CWUser', [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
868 |
[self.system], {'X': 'table1.C0'}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
869 |
('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
|
870 |
[self.system], {}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
871 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
872 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
873 |
[('Any X LIMIT 10 OFFSET 10', [{'X': 'CWUser'}, {'X': 'Personne'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
874 |
10, 10, [self.system], {'X': 'table0.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
875 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
876 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
877 |
def test_security_complex_aggregat(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
878 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
879 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
880 |
self._test('Any MAX(X)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
881 |
[('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
|
882 |
[self.rql, self.system], None, {'E': 'table1.C0'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
883 |
('FetchStep', [('Any X WHERE X is CWUser', [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
884 |
[self.ldap, self.system], None, {'X': 'table2.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
885 |
('UnionFetchStep', [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
886 |
('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
|
887 |
[self.system], {}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
888 |
('UnionFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
889 |
[('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
|
890 |
[{'X': 'Card'}, {'X': 'Note'}, {'X': 'State'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
891 |
[self.rql, self.system], {}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
892 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
893 |
[('Any X WHERE X is IN(Bookmark, Comment, Division, CWCache, CWConstraint, CWConstraintType, CWEType, CWAttribute, CWGroup, CWRelation, CWPermission, CWProperty, CWRType, Email, EmailAddress, EmailPart, EmailThread, File, Folder, Image, Personne, RQLExpression, Societe, SubDivision, Tag, TrInfo, Transition)', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
894 |
sorted([{'X': 'Bookmark'}, {'X': 'Comment'}, {'X': 'Division'}, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
895 |
{'X': 'CWCache'}, {'X': 'CWConstraint'}, {'X': 'CWConstraintType'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
896 |
{'X': 'CWEType'}, {'X': 'CWAttribute'}, {'X': 'CWGroup'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
897 |
{'X': 'CWRelation'}, {'X': 'CWPermission'}, {'X': 'CWProperty'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
898 |
{'X': 'CWRType'}, {'X': 'Email'}, {'X': 'EmailAddress'}, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
899 |
{'X': 'EmailPart'}, {'X': 'EmailThread'}, {'X': 'File'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
900 |
{'X': 'Folder'}, {'X': 'Image'}, {'X': 'Personne'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
901 |
{'X': 'RQLExpression'}, {'X': 'Societe'}, {'X': 'SubDivision'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
902 |
{'X': 'Tag'}, {'X': 'TrInfo'}, {'X': 'Transition'}]))], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
903 |
[self.system], {}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
904 |
]), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
905 |
('FetchStep', [('Any X WHERE EXISTS(X owned_by 5), X is CWUser', [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
906 |
[self.system], {'X': 'table2.C0'}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
907 |
('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
|
908 |
[{'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
|
909 |
[self.system], {'E': 'table1.C0'}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
910 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
911 |
('OneFetchStep', [('Any MAX(X)', X_ALL_SOLS)], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
912 |
None, None, [self.system], {'X': 'table0.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
913 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
914 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
915 |
def test_security_complex_aggregat2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
916 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
917 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
918 |
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
|
919 |
[('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
|
920 |
[{'X': 'Card'}, {'X': 'Note'}, {'X': 'State'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
921 |
[self.rql, self.system], None, {'X': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
922 |
('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
|
923 |
[self.rql, self.system], None, {'E': 'table2.C0'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
924 |
('FetchStep', [('Any X WHERE X is CWUser', [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
925 |
[self.ldap, self.system], None, {'X': 'table3.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
926 |
('UnionFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
927 |
[('FetchStep', [('Any ET,X WHERE X is ET, EXISTS(X owned_by 5), ET is CWEType, X is Basket', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
928 |
[{'ET': 'CWEType', 'X': 'Basket'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
929 |
[self.system], {}, {'ET': 'table0.C0', 'X': 'table0.C1'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
930 |
('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 CWEType, X is Affaire', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
931 |
[{'C': 'Division', 'E': 'Note', 'D': 'Affaire', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
932 |
'G': 'SubDivision', 'F': 'Societe', 'I': 'Affaire', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
933 |
'H': 'Affaire', 'J': 'Affaire', 'X': 'Affaire', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
934 |
'ET': 'CWEType'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
935 |
[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
|
936 |
[]), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
937 |
('FetchStep', [('Any ET,X WHERE X is ET, EXISTS(X owned_by 5), ET is CWEType, X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
938 |
[{'ET': 'CWEType', 'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
939 |
[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
|
940 |
# 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
|
941 |
('UnionFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
942 |
[('FetchStep', [('Any ET,X WHERE X is ET, ET is CWEType, X is IN(Bookmark, Comment, Division, CWCache, CWConstraint, CWConstraintType, CWEType, CWAttribute, CWGroup, CWRelation, CWPermission, CWProperty, CWRType, Email, EmailAddress, EmailPart, EmailThread, File, Folder, Image, Personne, RQLExpression, Societe, SubDivision, Tag, TrInfo, Transition)', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
943 |
[{'X': 'Bookmark', 'ET': 'CWEType'}, {'X': 'Comment', 'ET': 'CWEType'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
944 |
{'X': 'Division', 'ET': 'CWEType'}, {'X': 'CWCache', 'ET': 'CWEType'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
945 |
{'X': 'CWConstraint', 'ET': 'CWEType'}, {'X': 'CWConstraintType', 'ET': 'CWEType'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
946 |
{'X': 'CWEType', 'ET': 'CWEType'}, {'X': 'CWAttribute', 'ET': 'CWEType'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
947 |
{'X': 'CWGroup', 'ET': 'CWEType'}, {'X': 'CWRelation', 'ET': 'CWEType'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
948 |
{'X': 'CWPermission', 'ET': 'CWEType'}, {'X': 'CWProperty', 'ET': 'CWEType'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
949 |
{'X': 'CWRType', 'ET': 'CWEType'}, {'X': 'Email', 'ET': 'CWEType'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
950 |
{'X': 'EmailAddress', 'ET': 'CWEType'}, {'X': 'EmailPart', 'ET': 'CWEType'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
951 |
{'X': 'EmailThread', 'ET': 'CWEType'}, {'X': 'File', 'ET': 'CWEType'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
952 |
{'X': 'Folder', 'ET': 'CWEType'}, {'X': 'Image', 'ET': 'CWEType'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
953 |
{'X': 'Personne', 'ET': 'CWEType'}, {'X': 'RQLExpression', 'ET': 'CWEType'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
954 |
{'X': 'Societe', 'ET': 'CWEType'}, {'X': 'SubDivision', 'ET': 'CWEType'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
955 |
{'X': 'Tag', 'ET': 'CWEType'}, {'X': 'TrInfo', 'ET': 'CWEType'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
956 |
{'X': 'Transition', 'ET': 'CWEType'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
957 |
[self.system], {}, {'ET': 'table0.C0', 'X': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
958 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
959 |
[('Any ET,X WHERE X is ET, ET is CWEType, X is IN(Card, Note, State)', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
960 |
[{'ET': 'CWEType', 'X': 'Card'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
961 |
{'ET': 'CWEType', 'X': 'Note'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
962 |
{'ET': 'CWEType', 'X': 'State'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
963 |
[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
|
964 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
965 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
966 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
967 |
[('Any ET,COUNT(X) GROUPBY ET ORDERBY ET', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
968 |
sorted([{'ET': 'CWEType', 'X': 'Affaire'}, {'ET': 'CWEType', 'X': 'Basket'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
969 |
{'ET': 'CWEType', 'X': 'Bookmark'}, {'ET': 'CWEType', 'X': 'Card'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
970 |
{'ET': 'CWEType', 'X': 'Comment'}, {'ET': 'CWEType', 'X': 'Division'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
971 |
{'ET': 'CWEType', 'X': 'CWCache'}, {'ET': 'CWEType', 'X': 'CWConstraint'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
972 |
{'ET': 'CWEType', 'X': 'CWConstraintType'}, {'ET': 'CWEType', 'X': 'CWEType'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
973 |
{'ET': 'CWEType', 'X': 'CWAttribute'}, {'ET': 'CWEType', 'X': 'CWGroup'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
974 |
{'ET': 'CWEType', 'X': 'CWRelation'}, {'ET': 'CWEType', 'X': 'CWPermission'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
975 |
{'ET': 'CWEType', 'X': 'CWProperty'}, {'ET': 'CWEType', 'X': 'CWRType'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
976 |
{'ET': 'CWEType', 'X': 'CWUser'}, {'ET': 'CWEType', 'X': 'Email'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
977 |
{'ET': 'CWEType', 'X': 'EmailAddress'}, {'ET': 'CWEType', 'X': 'EmailPart'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
978 |
{'ET': 'CWEType', 'X': 'EmailThread'}, {'ET': 'CWEType', 'X': 'File'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
979 |
{'ET': 'CWEType', 'X': 'Folder'}, {'ET': 'CWEType', 'X': 'Image'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
980 |
{'ET': 'CWEType', 'X': 'Note'}, {'ET': 'CWEType', 'X': 'Personne'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
981 |
{'ET': 'CWEType', 'X': 'RQLExpression'}, {'ET': 'CWEType', 'X': 'Societe'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
982 |
{'ET': 'CWEType', 'X': 'State'}, {'ET': 'CWEType', 'X': 'SubDivision'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
983 |
{'ET': 'CWEType', 'X': 'Tag'}, {'ET': 'CWEType', 'X': 'TrInfo'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
984 |
{'ET': 'CWEType', 'X': 'Transition'}]))], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
985 |
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
|
986 |
]) |
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_security_3sources(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
989 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
990 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
991 |
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
|
992 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
993 |
[('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
|
994 |
[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
|
995 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
996 |
[('Any U WHERE U login "syt", U is CWUser', [{'U': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
997 |
[self.ldap, self.system], None, {'U': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
998 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
999 |
[('Any X,XT WHERE X owned_by U, X title XT, EXISTS(U owned_by 5), U is CWUser, X is Card', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1000 |
[{'X': 'Card', 'U': 'CWUser', 'XT': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1001 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1002 |
{'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
|
1003 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1004 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1005 |
def test_security_3sources_identity(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1006 |
self.restore_orig_euser_security() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1007 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1008 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1009 |
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
|
1010 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1011 |
[('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
|
1012 |
[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
|
1013 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1014 |
[('Any X,XT WHERE X owned_by U, X title XT, U login "syt", EXISTS(U identity 5), U is CWUser, X is Card', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1015 |
[{'U': 'CWUser', 'X': 'Card', 'XT': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1016 |
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
|
1017 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1018 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1019 |
def test_security_3sources_identity_optional_var(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1020 |
self.restore_orig_euser_security() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1021 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1022 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1023 |
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
|
1024 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1025 |
[('Any U,L WHERE U identity 5, U login L, U is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1026 |
[{'L': 'String', u'U': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1027 |
[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
|
1028 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1029 |
[('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
|
1030 |
[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
|
1031 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1032 |
[('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
|
1033 |
[{'X': 'Card', 'XT': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1034 |
None, None, [self.system], {'L': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1035 |
'U': 'table0.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1036 |
'X': 'table1.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1037 |
'X.title': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1038 |
'XT': 'table1.C1'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1039 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1040 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1041 |
def test_security_3sources_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1042 |
# use a guest user |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1043 |
self.session = self._user_session()[1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1044 |
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
|
1045 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1046 |
[('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
|
1047 |
[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
|
1048 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1049 |
[('Any U WHERE U login "syt", U is CWUser', [{'U': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1050 |
[self.ldap, self.system], None, {'U': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1051 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1052 |
[('Any X,XT LIMIT 10 OFFSET 10 WHERE X owned_by U, X title XT, EXISTS(U owned_by 5), U is CWUser, X is Card', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1053 |
[{'X': 'Card', 'U': 'CWUser', 'XT': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1054 |
10, 10, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1055 |
{'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
|
1056 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1057 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1058 |
def test_exists_base(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1059 |
self._test('Any X,L,S WHERE X in_state S, X login L, EXISTS(X in_group G, G name "bougloup")', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1060 |
[('FetchStep', [('Any X,L WHERE X login L, X is CWUser', [{'X': 'CWUser', 'L': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1061 |
[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
|
1062 |
('OneFetchStep', [("Any X,L,S WHERE X in_state S, X login L, " |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1063 |
'EXISTS(X in_group G, G name "bougloup", G is CWGroup), S is State, X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1064 |
[{'X': 'CWUser', 'L': 'String', 'S': 'State', 'G': 'CWGroup'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1065 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1066 |
{'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
|
1067 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1068 |
def test_exists_complex(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1069 |
self._test('Any G WHERE X in_group G, G name "managers", EXISTS(X copain T, T login in ("comme", "cochon"))', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1070 |
[('FetchStep', [('Any T WHERE T login IN("comme", "cochon"), T is CWUser', [{'T': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1071 |
[self.ldap, self.system], None, {'T': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1072 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1073 |
[('Any G WHERE X in_group G, G name "managers", EXISTS(X copain T, T is CWUser), G is CWGroup, X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1074 |
[{'X': 'CWUser', 'T': 'CWUser', 'G': 'CWGroup'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1075 |
None, None, [self.system], {'T': 'table0.C0'}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1076 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1077 |
def test_exists3(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1078 |
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
|
1079 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1080 |
[('Any T WHERE T login IN("comme", "cochon"), T is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1081 |
[{'T': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1082 |
[self.ldap, self.system], None, {'T': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1083 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1084 |
[('Any L,X WHERE X login L, X is CWUser', [{'X': 'CWUser', 'L': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1085 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1086 |
{'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
|
1087 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1088 |
[('Any G,L WHERE X in_group G, X login L, G name "managers", EXISTS(X copain T, T is CWUser), G is CWGroup, X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1089 |
[{'G': 'CWGroup', 'L': 'String', 'T': 'CWUser', 'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1090 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1091 |
[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
|
1092 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1093 |
def test_exists4(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1094 |
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
|
1095 |
'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
|
1096 |
'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
|
1097 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1098 |
[('Any T,L WHERE T login L, T login IN("comme", "cochon"), T is CWUser', [{'T': 'CWUser', 'L': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1099 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1100 |
{'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
|
1101 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1102 |
[('Any T2 WHERE T2 login "billy", T2 is CWUser', [{'T2': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1103 |
[self.ldap, self.system], None, {'T2': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1104 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1105 |
[('Any L,X WHERE X login L, X is CWUser', [{'X': 'CWUser', 'L': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1106 |
[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
|
1107 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1108 |
[('Any G,L WHERE X in_group G, X login L, G name "managers", (EXISTS(X copain T, T login L, T is CWUser)) OR (EXISTS(X in_state S, S name "pascontent", NOT X copain T2, S is State, T2 is CWUser)), G is CWGroup, X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1109 |
[{'G': 'CWGroup', 'L': 'String', 'S': 'State', 'T': 'CWUser', 'T2': 'CWUser', 'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1110 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1111 |
{'T2': 'table1.C0', 'L': 'table2.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1112 |
'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
|
1113 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1114 |
def test_exists5(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1115 |
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
|
1116 |
'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
|
1117 |
'NOT EXISTS(X copain T2, T2 login "billy")', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1118 |
[('FetchStep', [('Any T WHERE T login IN("comme", "cochon"), T is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1119 |
[{'T': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1120 |
[self.ldap, self.system], None, {'T': 'table0.C0'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1121 |
('FetchStep', [('Any T2 WHERE T2 login "billy", T2 is CWUser', [{'T2': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1122 |
[self.ldap, self.system], None, {'T2': 'table1.C0'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1123 |
('FetchStep', [('Any L,X WHERE X login L, X is CWUser', [{'X': 'CWUser', 'L': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1124 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1125 |
{'X': 'table2.C1', 'X.login': 'table2.C0', 'L': 'table2.C0'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1126 |
('OneFetchStep', [('Any GN,L WHERE X in_group G, X login L, G name GN, EXISTS(X copain T, T is CWUser), NOT EXISTS(X copain T2, T2 is CWUser), G is CWGroup, X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1127 |
[{'G': 'CWGroup', 'GN': 'String', 'L': 'String', 'T': 'CWUser', 'T2': 'CWUser', 'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1128 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1129 |
{'T': 'table0.C0', 'T2': 'table1.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1130 |
'X': 'table2.C1', 'X.login': 'table2.C0', 'L': 'table2.C0'}, [])]) |
392 | 1131 |
|
1132 |
def test_exists_security_no_invariant(self): |
|
1133 |
ueid = self.session.user.eid |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1134 |
self._test('Any X,AA,AB,AC,AD ORDERBY AA WHERE X is CWUser, X login AA, X firstname AB, X surname AC, X modification_date AD, A eid %(B)s, \ |
392 | 1135 |
EXISTS(((X identity A) OR \ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1136 |
(EXISTS(X in_group C, C name IN("managers", "staff"), C is CWGroup))) OR \ |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1137 |
(EXISTS(X in_group D, A in_group D, NOT D name "users", D is CWGroup)))', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1138 |
[('FetchStep', [('Any X,AA,AB,AC,AD WHERE X login AA, X firstname AB, X surname AC, X modification_date AD, X is CWUser', |
392 | 1139 |
[{'AA': 'String', 'AB': 'String', 'AC': 'String', 'AD': 'Datetime', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1140 |
'X': 'CWUser'}])], |
392 | 1141 |
[self.ldap, self.system], None, {'AA': 'table0.C1', 'AB': 'table0.C2', |
1142 |
'AC': 'table0.C3', 'AD': 'table0.C4', |
|
1143 |
'X': 'table0.C0', |
|
1144 |
'X.firstname': 'table0.C2', |
|
1145 |
'X.login': 'table0.C1', |
|
1146 |
'X.modification_date': 'table0.C4', |
|
1147 |
'X.surname': 'table0.C3'}, []), |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1148 |
('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 CWGroup))) OR (EXISTS(X in_group D, 5 in_group D, NOT D name "users", D is CWGroup))), X is CWUser', |
392 | 1149 |
[{'AA': 'String', 'AB': 'String', 'AC': 'String', 'AD': 'Datetime', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1150 |
'C': 'CWGroup', 'D': 'CWGroup', 'X': 'CWUser'}])], |
392 | 1151 |
None, None, [self.system], |
1152 |
{'AA': 'table0.C1', 'AB': 'table0.C2', 'AC': 'table0.C3', 'AD': 'table0.C4', |
|
1153 |
'X': 'table0.C0', |
|
1154 |
'X.firstname': 'table0.C2', 'X.login': 'table0.C1', 'X.modification_date': 'table0.C4', 'X.surname': 'table0.C3'}, |
|
1155 |
[])], |
|
1156 |
{'B': ueid}) |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1157 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1158 |
def test_relation_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1159 |
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
|
1160 |
[('UnionStep', None, None, [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1161 |
('OneFetchStep', [('Any X,S WHERE X in_state S, S is State, X is IN(Affaire, CWUser)', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1162 |
[{'X': 'Affaire', 'S': 'State'}, {'X': 'CWUser', 'S': 'State'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1163 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1164 |
('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
|
1165 |
[{'X': 'Note', 'S': 'State'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1166 |
None, None, [self.rql, self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1167 |
])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1168 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1169 |
def test_relation_selection_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1170 |
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
|
1171 |
[('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
|
1172 |
[{'X': 'Note', 'S': 'State'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1173 |
[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
|
1174 |
('UnionStep', None, None, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1175 |
[('OneFetchStep', [('Any X,S,U WHERE X in_state S, X todo_by U, S is State, U is CWUser, X is Note', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1176 |
[{'X': 'Note', 'S': 'State', 'U': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1177 |
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
|
1178 |
('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
|
1179 |
[{'X': 'Affaire', 'S': 'State', 'U': 'Personne'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1180 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1181 |
]) |
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 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1184 |
def test_relation_restriction_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1185 |
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
|
1186 |
[('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
|
1187 |
[{'X': 'Note', 'S': 'State'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1188 |
[self.rql, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1189 |
('UnionStep', None, None, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1190 |
[('OneFetchStep', [('Any X,U WHERE X todo_by U, U is CWUser, X is Note', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1191 |
[{'X': 'Note', 'U': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1192 |
None, None, [self.system], {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1193 |
('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
|
1194 |
[{'S': 'State', 'U': 'Personne', 'X': 'Affaire'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1195 |
None, None, [self.system], {}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1196 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1197 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1198 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1199 |
def test_relation_restriction_ambigous_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1200 |
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
|
1201 |
[('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
|
1202 |
[{'X': 'Note', 'S': 'State'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1203 |
[self.rql, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1204 |
('UnionStep', None, None, [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1205 |
('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
|
1206 |
[{'X': 'Note', 'T': 'Tag'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1207 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1208 |
[self.system], {'X': 'table0.C0'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1209 |
('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, CWUser)', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1210 |
[{'X': 'Affaire', 'S': 'State', 'T': 'Tag'}, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1211 |
{'X': 'CWUser', 'S': 'State', 'T': 'Tag'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1212 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1213 |
[self.system], {}, []), |
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 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1216 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1217 |
def test_not_relation_no_split_internal(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1218 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1219 |
# 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
|
1220 |
# 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
|
1221 |
# 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
|
1222 |
# 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
|
1223 |
# generation for the external source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1224 |
self._test('Any SN WHERE NOT X in_state S, X eid %(x)s, S name SN', |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1225 |
[('OneFetchStep', [('Any SN WHERE NOT 5 in_state S, S name SN, S is State', |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1226 |
[{'S': 'State', 'SN': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1227 |
None, None, [self.rql, self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1228 |
{'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1229 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1230 |
def test_not_relation_no_split_external(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1231 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1232 |
# similar to the above test but with an eid coming from the external source. |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1233 |
# the same plan may be used, since we won't find any record in the system source |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1234 |
# linking 9999999 to a state |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1235 |
self._test('Any SN WHERE NOT X in_state S, X eid %(x)s, S name SN', |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1236 |
[('OneFetchStep', [('Any SN WHERE NOT 999999 in_state S, S name SN, S is State', |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1237 |
[{'S': 'State', 'SN': 'String'}])], |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1238 |
None, None, [self.rql, self.system], {}, [])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1239 |
{'x': 999999}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1240 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1241 |
def test_not_relation_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1242 |
self._test('Any SN WHERE NOT X in_state S, S name SN', |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1243 |
[('FetchStep', [('Any SN,S WHERE S name SN, S is State', |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1244 |
[{'S': 'State', 'SN': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1245 |
[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
|
1246 |
[]), |
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
|
1247 |
('IntersectStep', None, None, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1248 |
[('OneFetchStep', |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
1249 |
[('Any SN WHERE NOT X in_state S, S name SN, S is State, X is Note', |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
1250 |
[{'S': 'State', 'SN': 'String', 'X': 'Note'}])], |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
1251 |
None, None, [self.rql, self.system], {}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
1252 |
[]), |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
1253 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1254 |
[('Any SN WHERE NOT X in_state S, S name SN, S is State, X is IN(Affaire, CWUser)', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1255 |
[{'S': 'State', 'SN': 'String', 'X': 'Affaire'}, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1256 |
{'S': 'State', 'SN': 'String', 'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1257 |
None, None, [self.system], {'S': 'table0.C1', 'S.name': 'table0.C0', 'SN': 'table0.C0'}, |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
1258 |
[]),] |
332
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_external_attributes_and_relation(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1262 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1263 |
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
|
1264 |
[('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
|
1265 |
[{'A': 'Note', 'C': 'Datetime', 'B': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1266 |
[self.rql], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1267 |
{'A': 'table0.C0', 'A.creation_date': 'table0.C1', 'A.modification_date': 'table0.C2', 'C': 'table0.C2', 'B': 'table0.C1'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1268 |
#('FetchStep', [('Any D WHERE D is CWUser', [{'D': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1269 |
# [self.ldap, self.system], None, {'D': 'table1.C0'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1270 |
('OneFetchStep', [('Any A,B,C,D WHERE A creation_date B, A modification_date C, A todo_by D?, A is Note, D is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1271 |
[{'A': 'Note', 'C': 'Datetime', 'B': 'Datetime', 'D': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1272 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1273 |
{'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
|
1274 |
{'x': 999999}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1275 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1276 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1277 |
def test_simplified_var(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1278 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1279 |
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
|
1280 |
[('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', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1281 |
[{'X': 'Note', 'G': 'CWGroup', 'P': 'CWPermission'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1282 |
None, None, [self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1283 |
{'x': 999999, 'u': self.session.user.eid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1284 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1285 |
def test_has_text(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1286 |
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
|
1287 |
[('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
|
1288 |
[{'X': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1289 |
None, None, [self.system], {}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1290 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1291 |
def test_has_text_3(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1292 |
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
|
1293 |
[('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
|
1294 |
[{'X': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1295 |
[self.rql, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1296 |
('UnionStep', None, None, [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1297 |
('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
|
1298 |
[{'X': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1299 |
None, None, [self.system], {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1300 |
('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
|
1301 |
[{'X': 'EmailThread'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1302 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1303 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1304 |
]) |
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 |
def test_sort_func(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1307 |
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
|
1308 |
[('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
|
1309 |
('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
|
1310 |
[{'X': 'Note', 'RF': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1311 |
[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
|
1312 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1313 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1314 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1315 |
def test_ambigous_sort_func(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1316 |
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
|
1317 |
[('AggrStep', 'Any X ORDERBY DUMB_SORT(RF)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1318 |
None, None, 'table0', None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1319 |
[('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
|
1320 |
[{'X': 'Card', 'RF': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1321 |
[self.rql, self.system], {}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1322 |
{'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
|
1323 |
('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
|
1324 |
[{'RF': 'String', 'X': 'Bookmark'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1325 |
{'RF': 'String', 'X': 'EmailThread'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1326 |
[self.system], {}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1327 |
{'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
|
1328 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1329 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1330 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1331 |
def test_attr_unification_1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1332 |
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
|
1333 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1334 |
[('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
|
1335 |
[self.rql, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1336 |
{'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
|
1337 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1338 |
[('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
|
1339 |
[{'T': 'String', 'X': 'Bookmark', 'Y': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1340 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1341 |
{'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
|
1342 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1343 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1344 |
def test_attr_unification_2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1345 |
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
|
1346 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1347 |
[('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
|
1348 |
[self.rql, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1349 |
{'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
|
1350 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1351 |
[('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
|
1352 |
[self.rql, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1353 |
{'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
|
1354 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1355 |
[('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
|
1356 |
[{'T': 'String', 'X': 'Note', 'Y': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1357 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1358 |
{'T': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1359 |
'X': 'table0.C0', 'X.type': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1360 |
'Y': 'table1.C0', 'Y.title': 'table1.C1'}, []) |
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 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1363 |
def test_attr_unification_neq_1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1364 |
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
|
1365 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1366 |
[('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
|
1367 |
[{'D': 'Datetime', 'Y': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1368 |
[self.rql,self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1369 |
{'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
|
1370 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1371 |
[('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
|
1372 |
[{'D': 'Datetime', 'X': 'Bookmark', 'Y': 'Card'}])], None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1373 |
[self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1374 |
{'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
|
1375 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1376 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1377 |
def test_subquery_1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1378 |
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
|
1379 |
'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
|
1380 |
[('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
|
1381 |
('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
|
1382 |
[{'T': 'String', 'X': 'Bookmark'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1383 |
[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
|
1384 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1385 |
[('Any B,C WHERE B login C, B is CWUser', [{'B': 'CWUser', 'C': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1386 |
[self.ldap, self.system], None, {'B': 'table1.C0', 'B.login': 'table1.C1', 'C': 'table1.C1'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1387 |
('OneFetchStep', [('DISTINCT Any B,C ORDERBY C WHERE A created_by B, B login C, EXISTS(B owned_by 5), B is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1388 |
[{'A': 'Bookmark', 'B': 'CWUser', 'C': 'String'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1389 |
{'A': 'Tag', 'B': 'CWUser', 'C': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1390 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1391 |
{'A': 'table0.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1392 |
'B': 'table1.C0', 'B.login': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1393 |
'C': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1394 |
'N': 'table0.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1395 |
[])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1396 |
{'E': self.session.user.eid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1397 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1398 |
def test_subquery_2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1399 |
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
|
1400 |
'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
|
1401 |
[('UnionFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1402 |
[('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
|
1403 |
[self.system], {}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1404 |
{'N': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1405 |
'T': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1406 |
'X': 'table0.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1407 |
'X.name': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1408 |
'X.title': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1409 |
('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
|
1410 |
[{'T': 'String', 'X': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1411 |
[self.rql, self.system], {}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1412 |
{'N': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1413 |
'T': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1414 |
'X': 'table0.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1415 |
'X.name': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1416 |
'X.title': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1417 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1418 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1419 |
[('Any B,C WHERE B login C, B is CWUser', [{'B': 'CWUser', 'C': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1420 |
[self.ldap, self.system], None, {'B': 'table1.C0', 'B.login': 'table1.C1', 'C': 'table1.C1'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1421 |
('OneFetchStep', [('DISTINCT Any B,C ORDERBY C WHERE A created_by B, B login C, EXISTS(B owned_by 5), B is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1422 |
[{'A': 'Card', 'B': 'CWUser', 'C': 'String'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1423 |
{'A': 'Tag', 'B': 'CWUser', 'C': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1424 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1425 |
{'A': 'table0.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1426 |
'B': 'table1.C0', 'B.login': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1427 |
'C': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1428 |
'N': 'table0.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1429 |
[])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1430 |
{'E': self.session.user.eid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1431 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1432 |
def test_eid_dont_cross_relation(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1433 |
repo._type_source_cache[999999] = ('Personne', 'system', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1434 |
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
|
1435 |
[('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
|
1436 |
[{'X': 'Personne', 'Y': 'Card', 'YT': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1437 |
None, None, [self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1438 |
{'x': 999999}) |
393 | 1439 |
|
1440 |
||
1441 |
# external source w/ .cross_relations == ['multisource_crossed_rel'] ###### |
|
1442 |
||
1443 |
def test_crossed_relation_eid_1_invariant(self): |
|
1444 |
repo._type_source_cache[999999] = ('Note', 'system', 999999) |
|
1445 |
self._test('Any Y WHERE X eid %(x)s, X multisource_crossed_rel Y', |
|
1446 |
[('OneFetchStep', [('Any Y WHERE 999999 multisource_crossed_rel Y', [{u'Y': 'Note'}])], |
|
1447 |
None, None, [self.system], {}, []) |
|
1448 |
], |
|
1449 |
{'x': 999999,}) |
|
1450 |
||
1451 |
def test_crossed_relation_eid_1_needattr(self): |
|
1452 |
repo._type_source_cache[999999] = ('Note', 'system', 999999) |
|
1453 |
self._test('Any Y,T WHERE X eid %(x)s, X multisource_crossed_rel Y, Y type T', |
|
1454 |
[('FetchStep', [('Any Y,T WHERE Y type T, Y is Note', [{'T': 'String', 'Y': 'Note'}])], |
|
1455 |
[self.rql, self.system], None, |
|
1456 |
{'T': 'table0.C1', 'Y': 'table0.C0', 'Y.type': 'table0.C1'}, []), |
|
1457 |
('OneFetchStep', [('Any Y,T WHERE 999999 multisource_crossed_rel Y, Y type T, Y is Note', |
|
1458 |
[{'T': 'String', 'Y': 'Note'}])], |
|
1459 |
None, None, [self.system], |
|
1460 |
{'T': 'table0.C1', 'Y': 'table0.C0', 'Y.type': 'table0.C1'}, []), |
|
1461 |
], |
|
1462 |
{'x': 999999,}) |
|
1463 |
||
1464 |
def test_crossed_relation_eid_2_invariant(self): |
|
1465 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
|
1466 |
self._test('Any Y WHERE X eid %(x)s, X multisource_crossed_rel Y', |
|
1467 |
[('OneFetchStep', [('Any Y WHERE 999999 multisource_crossed_rel Y, Y is Note', [{'Y': 'Note'}])], |
|
1468 |
None, None, [self.rql, self.system], {}, []) |
|
1469 |
], |
|
1470 |
{'x': 999999,}) |
|
1471 |
||
1231
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1472 |
def test_crossed_relation_eid_2_needattr(self): |
393 | 1473 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
1231
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1474 |
self._test('Any Y,T WHERE X eid %(x)s, X multisource_crossed_rel Y, Y type T', |
393 | 1475 |
[('FetchStep', [('Any Y,T WHERE Y type T, Y is Note', [{'T': 'String', 'Y': 'Note'}])], |
1476 |
[self.rql, self.system], None, |
|
1477 |
{'T': 'table0.C1', 'Y': 'table0.C0', 'Y.type': 'table0.C1'}, []), |
|
1231
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1478 |
('UnionStep', None, None, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1479 |
[('OneFetchStep', [('Any Y,T WHERE 999999 multisource_crossed_rel Y, Y type T, Y is Note', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1480 |
[{'T': 'String', 'Y': 'Note'}])], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1481 |
None, None, [self.rql], None, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1482 |
[]), |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1483 |
('OneFetchStep', [('Any Y,T WHERE 999999 multisource_crossed_rel Y, Y type T, Y is Note', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1484 |
[{'T': 'String', 'Y': 'Note'}])], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1485 |
None, None, [self.system], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1486 |
{'T': 'table0.C1', 'Y': 'table0.C0', 'Y.type': 'table0.C1'}, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1487 |
[])] |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1488 |
)], |
393 | 1489 |
{'x': 999999,}) |
1490 |
||
1491 |
def test_crossed_relation_eid_not_1(self): |
|
1492 |
repo._type_source_cache[999999] = ('Note', 'system', 999999) |
|
1493 |
self._test('Any Y WHERE X eid %(x)s, NOT X multisource_crossed_rel Y', |
|
1494 |
[('FetchStep', [('Any Y WHERE Y is Note', [{'Y': 'Note'}])], |
|
1495 |
[self.rql, self.system], None, {'Y': 'table0.C0'}, []), |
|
1496 |
('OneFetchStep', [('Any Y WHERE NOT 999999 multisource_crossed_rel Y, Y is Note', |
|
1497 |
[{'Y': 'Note'}])], |
|
1498 |
None, None, [self.system], |
|
1499 |
{'Y': 'table0.C0'}, [])], |
|
1500 |
{'x': 999999,}) |
|
1501 |
||
1502 |
# def test_crossed_relation_eid_not_2(self): |
|
1503 |
# repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
|
1504 |
# self._test('Any Y WHERE X eid %(x)s, NOT X multisource_crossed_rel Y', |
|
1505 |
# [], |
|
1506 |
# {'x': 999999,}) |
|
1507 |
||
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1508 |
def test_crossed_relation_base_XXXFIXME(self): |
393 | 1509 |
repo._type_source_cache[999999] = ('Note', 'system', 999999) |
1510 |
self._test('Any X,Y,T WHERE X multisource_crossed_rel Y, Y type T, X type T', |
|
1511 |
[('FetchStep', [('Any X,T WHERE X type T, X is Note', [{'T': 'String', 'X': 'Note'}])], |
|
1512 |
[self.rql, self.system], None, |
|
1513 |
{'T': 'table0.C1', 'X': 'table0.C0', 'X.type': 'table0.C1'}, []), |
|
1514 |
('FetchStep', [('Any Y,T WHERE Y type T, Y is Note', [{'T': 'String', 'Y': 'Note'}])], |
|
1515 |
[self.rql, self.system], None, |
|
1516 |
{'T': 'table1.C1', 'Y': 'table1.C0', 'Y.type': 'table1.C1'}, []), |
|
1231
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1517 |
('UnionStep', None, None, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1518 |
[('OneFetchStep', [('Any X,Y,T WHERE X multisource_crossed_rel Y, Y type T, X type T, X is Note, Y is Note', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1519 |
[{'T': 'String', 'X': 'Note', 'Y': 'Note'}])], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1520 |
None, None, [self.rql], None, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1521 |
[]), |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1522 |
('OneFetchStep', [('Any X,Y,T WHERE X multisource_crossed_rel Y, Y type T, X type T, X is Note, Y is Note', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1523 |
[{'T': 'String', 'X': 'Note', 'Y': 'Note'}])], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1524 |
None, None, [self.system], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1525 |
{'T': 'table1.C1', 'X': 'table0.C0', 'X.type': 'table0.C1', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1526 |
'Y': 'table1.C0', 'Y.type': 'table1.C1'}, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1527 |
[])] |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1528 |
)], |
393 | 1529 |
{'x': 999999,}) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1530 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1531 |
# edition queries tests ################################################### |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1532 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1533 |
def test_insert_simplified_var_1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1534 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1535 |
repo._type_source_cache[999998] = ('State', 'system', None) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1536 |
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
|
1537 |
[('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
|
1538 |
[{'N': 'Note', 'T': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1539 |
[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
|
1540 |
('InsertStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1541 |
[('RelationsStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1542 |
[('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
|
1543 |
[{'N': 'Note', 'T': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1544 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1545 |
{'N.type': 'table0.C0', 'T': 'table0.C0'}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1546 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1547 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1548 |
{'n': 999999, 's': 999998}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1549 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1550 |
def test_insert_simplified_var_2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1551 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1552 |
repo._type_source_cache[999998] = ('State', 'system', None) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1553 |
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
|
1554 |
[('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
|
1555 |
[{'N': 'Note', 'T': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1556 |
[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
|
1557 |
('InsertStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1558 |
[('RelationsStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1559 |
[('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
|
1560 |
[{'N': 'Note', 'T': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1561 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1562 |
{'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
|
1563 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1564 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1565 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1566 |
{'n': 999999, 's': 999998}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1567 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1568 |
def test_insert_simplified_var_3(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1569 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1570 |
repo._type_source_cache[999998] = ('State', 'cards', 999998) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1571 |
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
|
1572 |
[('InsertStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1573 |
[('RelationsStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1574 |
[('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
|
1575 |
[{'N': 'Note', 'T': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1576 |
None, None, [self.rql], {}, [])] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1577 |
)] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1578 |
)], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1579 |
{'n': 999999, 's': 999998}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1580 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1581 |
def test_insert_simplified_var_4(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1582 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1583 |
repo._type_source_cache[999998] = ('State', 'system', None) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1584 |
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
|
1585 |
[('InsertStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1586 |
[('RelationsStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1587 |
[('OneFetchStep', [('Any 999998,999999', [{}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1588 |
None, None, [self.system], {}, [])] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1589 |
)] |
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 |
{'n': 999999, 's': 999998}) |
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_insert_simplified_var_5(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1594 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1595 |
repo._type_source_cache[999998] = ('State', 'system', None) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1596 |
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
|
1597 |
[('InsertStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1598 |
[('RelationsStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1599 |
[('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
|
1600 |
[{'A': 'Affaire'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1601 |
None, None, [self.system], {}, [])] |
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 |
{'n': 999999, 's': 999998}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1605 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1606 |
def test_delete_relation1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1607 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1608 |
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
|
1609 |
[('DeleteRelationsStep', [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1610 |
('OneFetchStep', [('Any 5,Y WHERE %s created_by Y, NOT Y eid %s, Y is CWUser'%(ueid, ueid), |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1611 |
[{'Y': 'CWUser'}])], |
332
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': ueid, 'y': ueid}) |
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_delete_relation2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1618 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1619 |
self._test('DELETE X created_by Y WHERE X eid %(x)s, NOT Y login "syt"', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1620 |
[('FetchStep', [('Any Y WHERE NOT Y login "syt", Y is CWUser', [{'Y': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1621 |
[self.ldap, self.system], None, {'Y': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1622 |
('DeleteRelationsStep', [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1623 |
('OneFetchStep', [('Any %s,Y WHERE %s created_by Y, Y is CWUser'%(ueid,ueid), [{'Y': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1624 |
None, None, [self.system], {'Y': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1625 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1626 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1627 |
{'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
|
1628 |
|
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
|
1629 |
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
|
1630 |
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
|
1631 |
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
|
1632 |
[('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
|
1633 |
[('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
|
1634 |
[{'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
|
1635 |
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
|
1636 |
]) |
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
|
1637 |
], |
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
|
1638 |
{'x': 999999}) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1639 |
|
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
|
1640 |
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
|
1641 |
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
|
1642 |
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
|
1643 |
[('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
|
1644 |
[('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
|
1645 |
[{'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
|
1646 |
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
|
1647 |
]) |
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
|
1648 |
], |
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
|
1649 |
{'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
|
1650 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1651 |
def test_update(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1652 |
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
|
1653 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1654 |
[('Any X WHERE X login "comme", X is CWUser', [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1655 |
[self.ldap, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1656 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1657 |
[('Any Y WHERE Y login "cochon", Y is CWUser', [{'Y': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1658 |
[self.ldap, self.system], None, {'Y': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1659 |
('UpdateStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1660 |
[('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1661 |
[('DISTINCT Any X,Y WHERE X is CWUser, Y is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1662 |
[{'X': 'CWUser', 'Y': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1663 |
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
|
1664 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1665 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1666 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1667 |
def test_update2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1668 |
self._test('SET U in_group G WHERE G name ~= "bougloup%", U login "admin"', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1669 |
[('FetchStep', [('Any U WHERE U login "admin", U is CWUser', [{'U': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1670 |
[self.ldap, self.system], None, {'U': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1671 |
('UpdateStep', [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1672 |
('OneFetchStep', [('DISTINCT Any U,G WHERE G name ILIKE "bougloup%", G is CWGroup, U is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1673 |
[{'U': 'CWUser', 'G': 'CWGroup'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1674 |
None, None, [self.system], {'U': 'table0.C0'}, []), |
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 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1677 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1678 |
def test_update3(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1679 |
anoneid = self._user_session()[1].user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1680 |
# 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
|
1681 |
# 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
|
1682 |
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
|
1683 |
[('UpdateStep', [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1684 |
('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
|
1685 |
[{'S': 'State'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1686 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1687 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1688 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1689 |
{'x': anoneid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1690 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1691 |
# def test_update4(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1692 |
# # since we are adding a in_state relation with a state from the system |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1693 |
# # source, CWUser should only be searched only in the system source as well |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1694 |
# 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
|
1695 |
# assert len(rset) == 1, rset |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1696 |
# activatedeid = rset[0][0] |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1697 |
# self._test('SET X in_state S WHERE X is CWUser, S eid %s' % activatedeid, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1698 |
# [('UpdateStep', [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1699 |
# ('OneFetchStep', [('DISTINCT Any X,%s WHERE X is CWUser' % activatedeid, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1700 |
# [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1701 |
# None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1702 |
# ]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1703 |
# ]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1704 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1705 |
# non regression tests #################################################### |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1706 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1707 |
def test_nonregr1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1708 |
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
|
1709 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1710 |
[('Any X WHERE X login "syt", X is CWUser', [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1711 |
[self.ldap, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1712 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1713 |
[('Any Y WHERE Y login "cochon", Y is CWUser', [{'Y': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1714 |
[self.ldap, self.system], None, {'Y': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1715 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1716 |
[('Any X,Y WHERE X copain Y, X is CWUser, Y is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1717 |
[{'X': 'CWUser', 'Y': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1718 |
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
|
1719 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1720 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1721 |
def test_nonregr2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1722 |
treid = self.session.user.latest_trinfo().eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1723 |
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
|
1724 |
[('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
|
1725 |
[{'X': 'Note', 'D': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1726 |
[self.rql, self.system], None, {'X': 'table0.C0', 'X.modification_date': 'table0.C1', 'D': 'table0.C1'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1727 |
('FetchStep', [('Any X,D WHERE X modification_date D, X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1728 |
[{'X': 'CWUser', 'D': 'Datetime'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1729 |
[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
|
1730 |
('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
|
1731 |
('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
|
1732 |
[{'X': 'Affaire', 'E': 'TrInfo', 'D': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1733 |
[self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1734 |
{}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1735 |
{'X': 'table2.C0', 'X.modification_date': 'table2.C1', 'D': 'table2.C1', 'E.wf_info_for': 'table2.C0'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1736 |
('FetchStep', [('Any X,D WHERE E eid %s, E wf_info_for X, X modification_date D, E is TrInfo, X is CWUser'%treid, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1737 |
[{'X': 'CWUser', 'E': 'TrInfo', 'D': 'Datetime'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1738 |
[self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1739 |
{'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
|
1740 |
{'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
|
1741 |
('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
|
1742 |
[{'X': 'Note', 'E': 'TrInfo', 'D': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1743 |
[self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1744 |
{'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
|
1745 |
{'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
|
1746 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1747 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1748 |
{'x': treid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1749 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1750 |
def test_nonregr3(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1751 |
# original jpl query: |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1752 |
# Any X, NOW - CD, P WHERE P is Project, U interested_in P, U is CWUser, U login "sthenault", X concerns P, X creation_date CD ORDERBY CD DESC LIMIT 5 |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1753 |
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', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1754 |
[('FetchStep', [('Any U WHERE U login "admin", U is CWUser', [{'U': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1755 |
[self.ldap, self.system], None, {'U': 'table0.C0'}, []), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1756 |
('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 CWUser, X is CWEType', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1757 |
[{'P': 'Bookmark', 'U': 'CWUser', 'X': 'CWEType', 'CD': 'Datetime'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1758 |
5, None, [self.system], {'U': 'table0.C0'}, [])] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1759 |
) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1760 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1761 |
def test_nonregr4(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1762 |
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
|
1763 |
'WF owned_by U?, X eid %(x)s', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1764 |
[#('FetchStep', [('Any U WHERE U is CWUser', [{'U': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1765 |
# [self.ldap, self.system], None, {'U': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1766 |
('OneFetchStep', [('Any U ORDERBY D DESC WHERE WF wf_info_for 5, WF creation_date D, WF from_state FS, WF owned_by U?', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1767 |
[{'WF': 'TrInfo', 'FS': 'State', 'U': 'CWUser', 'D': 'Datetime'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1768 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1769 |
[self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1770 |
{'x': self.session.user.eid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1771 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1772 |
def test_nonregr5(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1773 |
# original jpl query: |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1774 |
# 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
|
1775 |
# 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
|
1776 |
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
|
1777 |
noteeid = self.execute('INSERT Note X')[0][0] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1778 |
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
|
1779 |
'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
|
1780 |
[('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
|
1781 |
[{'P': 'Note', 'V': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1782 |
[self.rql, self.system], None, {'V': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1783 |
('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
|
1784 |
[{'B': 'Affaire', 'MB': 'Affaire', 'V': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1785 |
None, None, [self.system], {'V': 'table0.C0'}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1786 |
{'x': cardeid, 'p': noteeid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1787 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1788 |
def test_nonregr6(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1789 |
self._test('Any X WHERE X concerne Y', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1790 |
[('OneFetchStep', [('Any X WHERE X concerne Y', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1791 |
[{'Y': 'Division', 'X': 'Affaire'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1792 |
{'Y': 'Note', 'X': 'Affaire'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1793 |
{'Y': 'Societe', 'X': 'Affaire'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1794 |
{'Y': 'SubDivision', 'X': 'Affaire'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1795 |
{'Y': 'Affaire', 'X': 'Personne'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1796 |
None, None, [self.system], {}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1797 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1798 |
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
|
1799 |
[('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
|
1800 |
[self.rql, self.system], None, {'Y': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1801 |
('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
|
1802 |
[{'X': 'Affaire', 'Y': 'Note'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1803 |
None, None, [self.system], {'Y': 'table0.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1804 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1805 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1806 |
def test_nonregr7(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1807 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1808 |
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
|
1809 |
[('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
|
1810 |
[self.rql], None, {'WP': u'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1811 |
('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
|
1812 |
[{'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
|
1813 |
None, None, [self.system], {'WP': u'table0.C0'}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1814 |
{'n': 999999}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1815 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1816 |
def test_nonregr8(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1817 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1818 |
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
|
1819 |
[('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
|
1820 |
[self.rql], None, {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1821 |
('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
|
1822 |
[{'Z': 'Affaire'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1823 |
None, None, [self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1824 |
{'x': 999999}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1825 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1826 |
def test_nonregr9(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1827 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1828 |
repo._type_source_cache[999998] = ('Note', 'cards', 999998) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1829 |
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
|
1830 |
[('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
|
1831 |
[self.rql], None, {'Y': u'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1832 |
('UpdateStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1833 |
[('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
|
1834 |
[{'Y': 'Note'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1835 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1836 |
{'Y': u'table0.C0'}, [])])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1837 |
{'x': 999999, 'z': 999998}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1838 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1839 |
def test_nonregr10(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1840 |
repo._type_source_cache[999999] = ('CWUser', 'ldapuser', 999999) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1841 |
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
|
1842 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1843 |
[('Any X,AA,AB WHERE X login AA, X modification_date AB, X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1844 |
[{'AA': 'String', 'AB': 'Datetime', 'X': 'CWUser'}])], |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1845 |
[self.ldap, self.system], None, {'AA': 'table0.C1', 'AB': 'table0.C2', |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1846 |
'X': 'table0.C0', 'X.login': 'table0.C1', 'X.modification_date': 'table0.C2'}, |
332
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 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1849 |
[('Any X,AA,AB ORDERBY AA WHERE 999999 owned_by X, X login AA, X modification_date AB, X is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1850 |
[{'AA': 'String', 'AB': 'Datetime', 'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1851 |
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
|
1852 |
'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
|
1853 |
[]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1854 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1855 |
{'x': 999999}) |
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_nonregr11(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1858 |
repo._type_source_cache[999999] = ('Bookmark', 'system', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1859 |
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
|
1860 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1861 |
[('Any Y WHERE Y login "hop", Y is CWUser', [{'Y': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1862 |
[self.ldap, self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1863 |
None, {'Y': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1864 |
('UpdateStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1865 |
[('OneFetchStep', [('DISTINCT Any 999999,Y WHERE Y is CWUser', [{'Y': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1866 |
None, None, [self.system], {'Y': 'table0.C0'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1867 |
[])] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1868 |
)], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1869 |
{'x': 999999}) |
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 |
def test_nonregr12(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1872 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1873 |
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
|
1874 |
[('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
|
1875 |
[{'X': 'Note', 'Z': 'Datetime'}])], |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1876 |
[self.rql, self.system], None, {'X': 'table0.C0', 'X.modification_date': 'table0.C1', 'Z': 'table0.C1'}, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1877 |
[]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1878 |
('AggrStep', 'Any X ORDERBY Z DESC', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1879 |
None, None, 'table1', None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1880 |
[('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
|
1881 |
[{'X': 'Bookmark', 'Z': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1882 |
[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
|
1883 |
'Z': 'table1.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1884 |
[]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1885 |
('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
|
1886 |
[{'X': 'Note', 'Z': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1887 |
[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
|
1888 |
'Z': 'table0.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1889 |
{'X': 'table1.C0', 'X.modification_date': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1890 |
'Z': 'table1.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1891 |
[])] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1892 |
)], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1893 |
{'x': 999999}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1894 |
|
1121
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1895 |
def test_nonregr13_1(self): |
1122
9f37de24251f
fix rql2sq w/ outer join on subquery result
sylvain.thenault@logilab.fr
parents:
1121
diff
changeset
|
1896 |
# identity wrapped into exists: |
9f37de24251f
fix rql2sq w/ outer join on subquery result
sylvain.thenault@logilab.fr
parents:
1121
diff
changeset
|
1897 |
# should'nt propagate constraint that U is in the same source as ME |
1120
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
1898 |
self._test('Any B,U,UL GROUPBY B,U,UL WHERE B created_by U?, B is File ' |
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
1899 |
'WITH U,UL BEING (Any U,UL WHERE ME eid %(x)s, (EXISTS(U identity ME) ' |
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
1900 |
'OR (EXISTS(U in_group G, G name IN("managers", "staff")))) ' |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1901 |
'OR (EXISTS(U in_group H, ME in_group H, NOT H name "users")), U login UL, U is CWUser)', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1902 |
[('FetchStep', [('Any U,UL WHERE U login UL, U is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1903 |
[{'U': 'CWUser', 'UL': 'String'}])], |
1120
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
1904 |
[self.ldap, self.system], None, |
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
1905 |
{'U': 'table0.C0', 'U.login': 'table0.C1', 'UL': 'table0.C1'}, |
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
1906 |
[]), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1907 |
('FetchStep', [('Any U,UL WHERE ((EXISTS(U identity 5)) OR (EXISTS(U in_group G, G name IN("managers", "staff"), G is CWGroup))) OR (EXISTS(U in_group H, 5 in_group H, NOT H name "users", H is CWGroup)), U login UL, U is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1908 |
[{'G': 'CWGroup', 'H': 'CWGroup', 'U': 'CWUser', 'UL': 'String'}])], |
1120
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
1909 |
[self.system], |
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
1910 |
{'U': 'table0.C0', 'U.login': 'table0.C1', 'UL': 'table0.C1'}, |
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
1911 |
{'U': 'table1.C0', 'U.login': 'table1.C1', 'UL': 'table1.C1'}, |
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
1912 |
[]), |
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
1913 |
('OneFetchStep', [('Any B,U,UL GROUPBY B,U,UL WHERE B created_by U?, B is File', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1914 |
[{'B': 'File', 'U': 'CWUser', 'UL': 'String'}])], |
1120
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
1915 |
None, None, [self.system], |
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
1916 |
{'U': 'table1.C0', 'UL': 'table1.C1'}, |
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
1917 |
[])], |
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
1918 |
{'x': self.session.user.eid}) |
1121
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1919 |
|
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1920 |
def test_nonregr13_2(self): |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1921 |
# identity *not* wrapped into exists. |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1922 |
# |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1923 |
# XXX this test fail since in this case, in "U identity 5" U and 5 are |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1924 |
# from the same scope so constraints are applied (telling the U should |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1925 |
# come from the same source as user with eid 5). |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1926 |
# |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1927 |
# IMO this is normal, unless we introduce a special case for the |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1928 |
# identity relation. BUT I think it's better to leave it as is and to |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1929 |
# explain constraint propagation rules, and so why this should be |
1231
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1930 |
# wrapped in exists() if used in multi-source |
1121
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1931 |
self.skip('take a look at me if you wish') |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1932 |
self._test('Any B,U,UL GROUPBY B,U,UL WHERE B created_by U?, B is File ' |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1933 |
'WITH U,UL BEING (Any U,UL WHERE ME eid %(x)s, (U identity ME ' |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1934 |
'OR (EXISTS(U in_group G, G name IN("managers", "staff")))) ' |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1935 |
'OR (EXISTS(U in_group H, ME in_group H, NOT H name "users")), U login UL, U is CWUser)', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1936 |
[('FetchStep', [('Any U,UL WHERE U login UL, U is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1937 |
[{'U': 'CWUser', 'UL': 'String'}])], |
1121
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1938 |
[self.ldap, self.system], None, |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1939 |
{'U': 'table0.C0', 'U.login': 'table0.C1', 'UL': 'table0.C1'}, |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1940 |
[]), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1941 |
('FetchStep', [('Any U,UL WHERE ((U identity 5) OR (EXISTS(U in_group G, G name IN("managers", "staff"), G is CWGroup))) OR (EXISTS(U in_group H, 5 in_group H, NOT H name "users", H is CWGroup)), U login UL, U is CWUser', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1942 |
[{'G': 'CWGroup', 'H': 'CWGroup', 'U': 'CWUser', 'UL': 'String'}])], |
1121
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1943 |
[self.system], |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1944 |
{'U': 'table0.C0', 'U.login': 'table0.C1', 'UL': 'table0.C1'}, |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1945 |
{'U': 'table1.C0', 'U.login': 'table1.C1', 'UL': 'table1.C1'}, |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1946 |
[]), |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1947 |
('OneFetchStep', [('Any B,U,UL GROUPBY B,U,UL WHERE B created_by U?, B is File', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1948 |
[{'B': 'File', 'U': 'CWUser', 'UL': 'String'}])], |
1121
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1949 |
None, None, [self.system], |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1950 |
{'U': 'table1.C0', 'UL': 'table1.C1'}, |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1951 |
[])], |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1952 |
{'x': self.session.user.eid}) |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
1953 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1954 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1955 |
class MSPlannerTwoSameExternalSourcesTC(BasePlannerTC): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1956 |
"""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
|
1957 |
|
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1958 |
* 2 rql sources supporting Card |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1959 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1960 |
repo = repo |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1961 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1962 |
def setUp(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1963 |
self.o = repo.querier |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1964 |
self.session = repo._sessions.values()[0] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1965 |
self.pool = self.session.set_pool() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1966 |
self.schema = self.o.schema |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1967 |
self.sources = self.o._repo.sources |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1968 |
self.system = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1969 |
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
|
1970 |
{'uri': 'cards'})) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1971 |
repo.sources_by_uri['cards'] = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1972 |
self.rql = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1973 |
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
|
1974 |
{'uri': 'cards2'})) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1975 |
repo.sources_by_uri['cards2'] = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1976 |
self.rql2 = self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1977 |
do_monkey_patch() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1978 |
self.planner = MSPlanner(self.o.schema, self.o._rqlhelper) |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1979 |
assert repo.sources_by_uri['cards2'].support_relation('multisource_crossed_rel') |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1980 |
assert 'multisource_crossed_rel' in repo.sources_by_uri['cards2'].cross_relations |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1981 |
assert repo.sources_by_uri['cards'].support_relation('multisource_crossed_rel') |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1982 |
assert 'multisource_crossed_rel' in repo.sources_by_uri['cards'].cross_relations |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
1983 |
clear_ms_caches(repo) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1984 |
_test = test_plan |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1985 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1986 |
def tearDown(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1987 |
undo_monkey_patch() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1988 |
del self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1989 |
del self.sources[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1990 |
del repo.sources_by_uri['cards'] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1991 |
del repo.sources_by_uri['cards2'] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1992 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1993 |
def test_linked_external_entities(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1994 |
repo._type_source_cache[999999] = ('Tag', 'system', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1995 |
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
|
1996 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1997 |
[('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
|
1998 |
[self.rql, self.rql2, self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1999 |
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
|
2000 |
[]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2001 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2002 |
[('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
|
2003 |
[{'X': 'Card', 'XT': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2004 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2005 |
{'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
|
2006 |
[])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2007 |
{'t': 999999}) |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2008 |
|
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2009 |
def test_version_depends_on(self): |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2010 |
self.repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2011 |
self._test('Any X,AD,AE WHERE E eid %(x)s, E migrated_from X, X in_state AD, AD name AE', |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2012 |
[('FetchStep', [('Any X,AD,AE WHERE X in_state AD, AD name AE, AD is State, X is Note', |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2013 |
[{'AD': 'State', 'AE': 'String', 'X': 'Note'}])], |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2014 |
[self.rql, self.rql2, self.system], |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2015 |
None, {'AD': 'table0.C1', 'AD.name': 'table0.C2', |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2016 |
'AE': 'table0.C2', 'X': 'table0.C0'}, |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2017 |
[]), |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2018 |
('OneFetchStep', [('Any X,AD,AE WHERE 999999 migrated_from X, AD name AE, AD is State, X is Note', |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2019 |
[{'AD': 'State', 'AE': 'String', 'X': 'Note'}])], |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2020 |
None, None, [self.system], |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2021 |
{'AD': 'table0.C1', 'AD.name': 'table0.C2', 'AE': 'table0.C2', 'X': 'table0.C0'}, |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2022 |
[])], |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2023 |
{'x': 999999}) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2024 |
|
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2025 |
def test_version_crossed_depends_on_1(self): |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2026 |
self.repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2027 |
self._test('Any X,AD,AE WHERE E eid %(x)s, E multisource_crossed_rel X, X in_state AD, AD name AE', |
1231
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2028 |
[('FetchStep', [('Any X,AD,AE WHERE X in_state AD, AD name AE, AD is State, X is Note', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2029 |
[{'AD': 'State', 'AE': 'String', 'X': 'Note'}])], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2030 |
[self.rql, self.rql2, self.system], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2031 |
None, {'AD': 'table0.C1', 'AD.name': 'table0.C2', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2032 |
'AE': 'table0.C2', 'X': 'table0.C0'}, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2033 |
[]), |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2034 |
('UnionStep', None, None, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2035 |
[('OneFetchStep', [('Any X,AD,AE WHERE 999999 multisource_crossed_rel X, AD name AE, AD is State, X is Note', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2036 |
[{'AD': 'State', 'AE': 'String', 'X': 'Note'}])], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2037 |
None, None, [self.rql], None, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2038 |
[]), |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2039 |
('OneFetchStep', [('Any X,AD,AE WHERE 999999 multisource_crossed_rel X, AD name AE, AD is State, X is Note', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2040 |
[{'AD': 'State', 'AE': 'String', 'X': 'Note'}])], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2041 |
None, None, [self.system], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2042 |
{'AD': 'table0.C1', 'AD.name': 'table0.C2', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2043 |
'AE': 'table0.C2', 'X': 'table0.C0'}, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2044 |
[])] |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2045 |
)], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2046 |
{'x': 999999}) |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2047 |
|
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
2048 |
def test_version_crossed_depends_on_2(self): |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2049 |
self.repo._type_source_cache[999999] = ('Note', 'system', 999999) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2050 |
self._test('Any X,AD,AE WHERE E eid %(x)s, E multisource_crossed_rel X, X in_state AD, AD name AE', |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
2051 |
[('FetchStep', [('Any X,AD,AE WHERE X in_state AD, AD name AE, AD is State, X is Note', |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
2052 |
[{'AD': 'State', 'AE': 'String', 'X': 'Note'}])], |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
2053 |
[self.rql, self.rql2, self.system], |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
2054 |
None, {'AD': 'table0.C1', 'AD.name': 'table0.C2', |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
2055 |
'AE': 'table0.C2', 'X': 'table0.C0'}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
2056 |
[]), |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
2057 |
('OneFetchStep', [('Any X,AD,AE WHERE 999999 multisource_crossed_rel X, AD name AE, AD is State, X is Note', |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
2058 |
[{'AD': 'State', 'AE': 'String', 'X': 'Note'}])], |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
2059 |
None, None, [self.system], |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
2060 |
{'AD': 'table0.C1', 'AD.name': 'table0.C2', 'AE': 'table0.C2', 'X': 'table0.C0'}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
2061 |
[])], |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2062 |
{'x': 999999}) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2063 |
|
1231
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2064 |
def test_version_crossed_depends_on_3(self): |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2065 |
self._test('Any X,AD,AE WHERE E multisource_crossed_rel X, X in_state AD, AD name AE, E is Note', |
1231
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2066 |
[('FetchStep', [('Any X,AD,AE WHERE X in_state AD, AD name AE, AD is State, X is Note', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2067 |
[{'AD': 'State', 'AE': 'String', 'X': 'Note'}])], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2068 |
[self.rql, self.rql2, self.system], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2069 |
None, {'AD': 'table0.C1', 'AD.name': 'table0.C2', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2070 |
'AE': 'table0.C2', 'X': 'table0.C0'}, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2071 |
[]), |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2072 |
('FetchStep', [('Any E WHERE E is Note', [{'E': 'Note'}])], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2073 |
[self.rql, self.rql2, self.system], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2074 |
None, {'E': 'table1.C0'}, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2075 |
[]), |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2076 |
('UnionStep', None, None, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2077 |
[('OneFetchStep', [('Any X,AD,AE WHERE E multisource_crossed_rel X, AD name AE, AD is State, E is Note, X is Note', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2078 |
[{'AD': 'State', 'AE': 'String', 'E': 'Note', 'X': 'Note'}])], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2079 |
None, None, [self.rql, self.rql2], None, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2080 |
[]), |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2081 |
('OneFetchStep', [('Any X,AD,AE WHERE E multisource_crossed_rel X, AD name AE, AD is State, E is Note, X is Note', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2082 |
[{'AD': 'State', 'AE': 'String', 'E': 'Note', 'X': 'Note'}])], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2083 |
None, None, [self.system], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2084 |
{'AD': 'table0.C1', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2085 |
'AD.name': 'table0.C2', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2086 |
'AE': 'table0.C2', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2087 |
'E': 'table1.C0', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2088 |
'X': 'table0.C0'}, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2089 |
[])] |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2090 |
)] |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2091 |
) |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2092 |
|
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2093 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2094 |
if __name__ == '__main__': |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2095 |
from logilab.common.testlib import unittest_main |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2096 |
unittest_main() |