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