author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Thu, 17 Feb 2011 16:46:18 +0100 | |
branch | stable |
changeset 7007 | 3804794b1ccd |
parent 6796 | e70ca9abfc51 |
child 6943 | 406a41c25e13 |
permissions | -rw-r--r-- |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5420
diff
changeset
|
1 |
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5420
diff
changeset
|
2 |
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5420
diff
changeset
|
3 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5420
diff
changeset
|
4 |
# This file is part of CubicWeb. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5420
diff
changeset
|
5 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5420
diff
changeset
|
6 |
# CubicWeb is free software: you can redistribute it and/or modify it under the |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5420
diff
changeset
|
7 |
# terms of the GNU Lesser General Public License as published by the Free |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5420
diff
changeset
|
8 |
# Software Foundation, either version 2.1 of the License, or (at your option) |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5420
diff
changeset
|
9 |
# any later version. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5420
diff
changeset
|
10 |
# |
5424
8ecbcbff9777
replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5421
diff
changeset
|
11 |
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5420
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5420
diff
changeset
|
13 |
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5420
diff
changeset
|
14 |
# details. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5420
diff
changeset
|
15 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5420
diff
changeset
|
16 |
# You should have received a copy of the GNU Lesser General Public License along |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5420
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
6796
e70ca9abfc51
[unittest2] update to unittest2 assertRaises api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6794
diff
changeset
|
18 |
"""unit tests for module cubicweb.server.msplanner""" |
e70ca9abfc51
[unittest2] update to unittest2 assertRaises api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6794
diff
changeset
|
19 |
|
e70ca9abfc51
[unittest2] update to unittest2 assertRaises api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6794
diff
changeset
|
20 |
from __future__ import with_statement |
6129
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
21 |
|
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
22 |
from logilab.common.decorators import clear_cache |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
23 |
|
6759
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
24 |
from yams.buildobjs import RelationDefinition |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
25 |
from rql import BadRQLQuery |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
26 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
27 |
from cubicweb.devtools import init_test_database |
2076 | 28 |
from cubicweb.devtools.repotest import BasePlannerTC, test_plan |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
29 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
30 |
class _SetGenerator(object): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
31 |
"""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
|
32 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
33 |
def __getitem__(self, key): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
34 |
try: |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
35 |
it = iter(key) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
36 |
except TypeError: |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
37 |
it = (key,) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
38 |
return set(it) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
39 |
s = _SetGenerator() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
40 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
41 |
from cubicweb.schema import ERQLExpression |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
42 |
from cubicweb.server.sources import AbstractSource |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
43 |
from cubicweb.server.msplanner import MSPlanner, PartPlanInformation |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
44 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
45 |
class FakeUserROSource(AbstractSource): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
46 |
uri = 'zzz' |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
47 |
support_entities = {'CWUser': False} |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
48 |
support_relations = {} |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
49 |
def syntax_tree_search(self, *args, **kwargs): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
50 |
return [] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
51 |
|
1785 | 52 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
53 |
class FakeCardSource(AbstractSource): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
54 |
uri = 'ccc' |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
55 |
support_entities = {'Card': True, 'Note': True, 'State': True} |
393 | 56 |
support_relations = {'in_state': True, 'multisource_rel': True, 'multisource_inlined_rel': True, |
6129
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
57 |
'multisource_crossed_rel': True,} |
3633
2d81178bea5f
[multi-source] add test case for an encountered bug, fixed by adding state_of to dont_cross_relations. Added a note to remind me that something should be done to be smarter in handling this
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3587
diff
changeset
|
58 |
dont_cross_relations = set(('fiche', 'state_of')) |
393 | 59 |
cross_relations = set(('multisource_crossed_rel',)) |
1785 | 60 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
61 |
def syntax_tree_search(self, *args, **kwargs): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
62 |
return [] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
63 |
|
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
64 |
X_ALL_SOLS = sorted([{'X': 'Affaire'}, {'X': 'BaseTransition'}, {'X': 'Basket'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
65 |
{'X': 'Bookmark'}, {'X': 'CWAttribute'}, {'X': 'CWCache'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
66 |
{'X': 'CWConstraint'}, {'X': 'CWConstraintType'}, {'X': 'CWEType'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
67 |
{'X': 'CWGroup'}, {'X': 'CWPermission'}, {'X': 'CWProperty'}, |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
68 |
{'X': 'CWRType'}, {'X': 'CWRelation'}, |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
69 |
{'X': 'CWSource'}, {'X': 'CWSourceHostConfig'}, |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
70 |
{'X': 'CWUser'}, {'X': 'CWUniqueTogetherConstraint'}, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
71 |
{'X': 'Card'}, {'X': 'Comment'}, {'X': 'Division'}, |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
72 |
{'X': 'Email'}, {'X': 'EmailAddress'}, {'X': 'EmailPart'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
73 |
{'X': 'EmailThread'}, {'X': 'ExternalUri'}, {'X': 'File'}, |
5575
8a531340c3ef
no more Image type w/ cw 3.9
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5556
diff
changeset
|
74 |
{'X': 'Folder'}, {'X': 'Note'}, |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
75 |
{'X': 'Personne'}, {'X': 'RQLExpression'}, {'X': 'Societe'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
76 |
{'X': 'State'}, {'X': 'SubDivision'}, {'X': 'SubWorkflowExitPoint'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
77 |
{'X': 'Tag'}, {'X': 'TrInfo'}, {'X': 'Transition'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
78 |
{'X': 'Workflow'}, {'X': 'WorkflowTransition'}]) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
79 |
|
1785 | 80 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
81 |
# keep cnx so it's not garbage collected and the associated session is closed |
6781
5062d86d6ffe
[unittest2] use unittest2 module fixture api
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6759
diff
changeset
|
82 |
def setUpModule(*args): |
6631
26c303c3f1aa
[test] make test independant from the working directory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6427
diff
changeset
|
83 |
global repo, cnx |
26c303c3f1aa
[test] make test independant from the working directory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6427
diff
changeset
|
84 |
repo, cnx = init_test_database(apphome=BaseMSPlannerTC.datadir) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
85 |
|
6781
5062d86d6ffe
[unittest2] use unittest2 module fixture api
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6759
diff
changeset
|
86 |
def tearDownModule(*args): |
4766
162b2b127b15
[test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4764
diff
changeset
|
87 |
global repo, cnx |
162b2b127b15
[test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4764
diff
changeset
|
88 |
del repo, cnx |
162b2b127b15
[test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4764
diff
changeset
|
89 |
|
162b2b127b15
[test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4764
diff
changeset
|
90 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
91 |
class BaseMSPlannerTC(BasePlannerTC): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
92 |
"""test planner related feature on a 3-sources repository: |
1785 | 93 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
94 |
* 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
|
95 |
* ldap source supporting CWUser |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
96 |
* rql source supporting Card |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
97 |
""" |
1785 | 98 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
99 |
def setUp(self): |
6631
26c303c3f1aa
[test] make test independant from the working directory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6427
diff
changeset
|
100 |
self.__class__.repo = repo |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
101 |
#_QuerierTC.setUp(self) |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
102 |
self.setup() |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
103 |
# hijack Affaire security |
4191
01638461d4b0
test update. All cw tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3890
diff
changeset
|
104 |
affreadperms = list(self.schema['Affaire'].permissions['read']) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
105 |
self.prevrqlexpr_affaire = affreadperms[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
106 |
# 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
|
107 |
affreadperms[-1] = ERQLExpression('X concerne S?, S owned_by U, S type "X"') |
4685
8a2d3a7f62d1
use set_action_permissions is clearer and avoid @cached issue across tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4674
diff
changeset
|
108 |
self.schema['Affaire'].set_action_permissions('read', affreadperms) |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
109 |
# hijack CWUser security |
4191
01638461d4b0
test update. All cw tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3890
diff
changeset
|
110 |
userreadperms = list(self.schema['CWUser'].permissions['read']) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
111 |
self.prevrqlexpr_user = userreadperms[-1] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
112 |
userreadperms[-1] = ERQLExpression('X owned_by U') |
4685
8a2d3a7f62d1
use set_action_permissions is clearer and avoid @cached issue across tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4674
diff
changeset
|
113 |
self.schema['CWUser'].set_action_permissions('read', userreadperms) |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
114 |
self.add_source(FakeUserROSource, 'ldap') |
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
115 |
self.add_source(FakeCardSource, 'cards') |
1785 | 116 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
117 |
def tearDown(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
118 |
# restore hijacked security |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
119 |
self.restore_orig_affaire_security() |
4191
01638461d4b0
test update. All cw tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3890
diff
changeset
|
120 |
self.restore_orig_cwuser_security() |
4775
3a37f0ce7527
[test] call super class teardown after perms restoration
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
diff
changeset
|
121 |
super(BaseMSPlannerTC, self).tearDown() |
1785 | 122 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
123 |
def restore_orig_affaire_security(self): |
4191
01638461d4b0
test update. All cw tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3890
diff
changeset
|
124 |
affreadperms = list(self.schema['Affaire'].permissions['read']) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
125 |
affreadperms[-1] = self.prevrqlexpr_affaire |
4685
8a2d3a7f62d1
use set_action_permissions is clearer and avoid @cached issue across tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4674
diff
changeset
|
126 |
self.schema['Affaire'].set_action_permissions('read', affreadperms) |
1785 | 127 |
|
4191
01638461d4b0
test update. All cw tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3890
diff
changeset
|
128 |
def restore_orig_cwuser_security(self): |
01638461d4b0
test update. All cw tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3890
diff
changeset
|
129 |
if hasattr(self, '_orig_cwuser_security_restored'): |
01638461d4b0
test update. All cw tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3890
diff
changeset
|
130 |
return |
01638461d4b0
test update. All cw tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3890
diff
changeset
|
131 |
self._orig_cwuser_security_restored = True |
01638461d4b0
test update. All cw tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3890
diff
changeset
|
132 |
userreadperms = list(self.schema['CWUser'].permissions['read']) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
133 |
userreadperms[-1] = self.prevrqlexpr_user |
4685
8a2d3a7f62d1
use set_action_permissions is clearer and avoid @cached issue across tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4674
diff
changeset
|
134 |
self.schema['CWUser'].set_action_permissions('read', userreadperms) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
135 |
|
1785 | 136 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
137 |
class PartPlanInformationTC(BaseMSPlannerTC): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
138 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
139 |
def _test(self, rql, *args): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
140 |
if len(args) == 3: |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
141 |
kwargs, sourcesterms, needsplit = args |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
142 |
else: |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
143 |
sourcesterms, needsplit = args |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
144 |
kwargs = None |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
145 |
plan = self._prepare_plan(rql, kwargs) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
146 |
union = plan.rqlst |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
147 |
plan.preprocess(union) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
148 |
ppi = PartPlanInformation(plan, union.children[0]) |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
149 |
for sourcevars in ppi._sourcesterms.itervalues(): |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
150 |
for var in sourcevars.keys(): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
151 |
solindices = sourcevars.pop(var) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
152 |
sourcevars[var._ms_table_key()] = solindices |
6340
470d8e828fda
[test] update test to unittest2 api (still using lgc.testlib though)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6209
diff
changeset
|
153 |
self.assertEqual(ppi._sourcesterms, sourcesterms) |
470d8e828fda
[test] update test to unittest2 api (still using lgc.testlib though)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6209
diff
changeset
|
154 |
self.assertEqual(ppi.needsplit, needsplit) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
155 |
|
1785 | 156 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
157 |
def test_simple_system_only(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
158 |
"""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
|
159 |
self._test('CWGroup X', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
160 |
{self.system: {'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_ldap(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
163 |
"""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
|
164 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
165 |
self._test('CWUser X', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
166 |
{self.system: {'X': s[0]}, self.ldap: {'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_system_rql(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
169 |
"""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
|
170 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
171 |
self._test('Any X, XT WHERE X is Card, X title XT', |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
172 |
{self.system: {'X': s[0]}, self.cards: {'X': s[0]}}, False) |
1785 | 173 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
174 |
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
|
175 |
"""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
|
176 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
177 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
178 |
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
|
179 |
{self.system: {'X': s[0]}}, False) |
1785 | 180 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
181 |
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
|
182 |
"""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
|
183 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
184 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
185 |
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
|
186 |
{self.system: {'x': 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_simple_invariant(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 (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
|
190 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
191 |
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
|
192 |
{self.system: {'X': s[0], 'G': s[0], 'in_group': s[0]}}, False) |
1785 | 193 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
194 |
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
|
195 |
"""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
|
196 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
197 |
# 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
|
198 |
# 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
|
199 |
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
|
200 |
{self.system: {'X': s[0]}}, False) |
1785 | 201 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
202 |
def test_complex_base(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
203 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
204 |
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
|
205 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
206 |
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
|
207 |
G name 'users' on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
208 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
209 |
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
|
210 |
{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
|
211 |
self.ldap : {'X': s[0]}}, True) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
212 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
213 |
def test_complex_invariant_ordered(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
214 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
215 |
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
|
216 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
217 |
2. return the result of Any X,AA ORDERBY AA WHERE %s owned_by X, X modification_date AA |
1785 | 218 |
on the system source |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
219 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
220 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
221 |
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
|
222 |
{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
|
223 |
self.ldap : {'X': s[0]}}, True) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
224 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
225 |
def test_complex_invariant(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
226 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
227 |
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
|
228 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
229 |
2. return the result of Any X,L,AA WHERE %s owned_by X, X login L, X modification_date AA |
1785 | 230 |
on the system source |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
231 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
232 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
233 |
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
|
234 |
{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
|
235 |
self.ldap : {'X': s[0]}}, True) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
236 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
237 |
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
|
238 |
"""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
|
239 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
240 |
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
|
241 |
{self.system: {'X': s[0, 1]}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
242 |
self.ldap: {'X': s[0]}}, True) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
243 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
244 |
def test_complex_multiple(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
245 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
246 |
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
|
247 |
cartesian product of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
248 |
2. return the result of Any X,Y WHERE X login 'syt', Y login 'adim' |
1785 | 249 |
on the system source |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
250 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
251 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
252 |
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
|
253 |
{self.system: {'Y': s[0], 'X': s[0]}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
254 |
self.ldap: {'Y': s[0], 'X': s[0]}}, True) |
1785 | 255 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
256 |
def test_complex_aggregat(self): |
3689
deb13e88e037
follow yams 0.25 api changes to improve performance
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3633
diff
changeset
|
257 |
solindexes = set(range(len([e for e in self.schema.entities() if not e.final]))) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
258 |
self._test('Any MAX(X)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
259 |
{self.system: {'X': solindexes}}, False) |
1785 | 260 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
261 |
def test_complex_optional(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
262 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
263 |
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
|
264 |
{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
|
265 |
'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
|
266 |
'x': s[0]}}, |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
267 |
False) |
1785 | 268 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
269 |
def test_exists4(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
270 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
271 |
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
|
272 |
but since X cannot come from the rql source, the solution |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
273 |
{self.cards : 'S'} must be removed |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
274 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
275 |
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
|
276 |
'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
|
277 |
'EXISTS(X in_state S, S name "pascontent", NOT X copain T2, T2 login "billy")', |
1785 | 278 |
{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
|
279 |
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
|
280 |
True) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
281 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
282 |
def test_relation_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
283 |
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
|
284 |
{self.system: {'X': s[0, 1, 2], 'S': s[0, 1, 2]}, |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
285 |
self.cards: {'X': s[2], 'S': s[2]}}, |
1230
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_need_split(self): |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
289 |
self._test('Any SN WHERE NOT X in_state S, S name SN', |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
290 |
{self.cards: {'X': s[2], 'S': s[0, 1, 2]}, |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
291 |
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
|
292 |
True) |
1785 | 293 |
|
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
294 |
def test_not_relation_no_split_external(self): |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
295 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
296 |
# 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
|
297 |
# the same plan may be used, since we won't find any record in the system source |
1785 | 298 |
# linking 9999999 to a state |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
299 |
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
|
300 |
{'x': 999999}, |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
301 |
{self.cards: {'x': s[0], 'S': s[0]}, |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
302 |
self.system: {'x': s[0], 'S': s[0]}}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
303 |
False) |
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_relation_restriction_ambigous_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
306 |
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
|
307 |
{self.system: {'X': s[0, 1, 2], 'S': s[0, 1, 2], 'T': s[0, 1, 2], 'tags': s[0, 1, 2]}, |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
308 |
self.cards: {'X': s[2], 'S': s[2]}}, |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
309 |
True) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
310 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
311 |
def test_simplified_var(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
312 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
313 |
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
|
314 |
{'x': 999999, 'u': self.session.user.eid}, |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
315 |
{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
|
316 |
'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
|
317 |
'u': s[0]}}, |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
318 |
False) |
1785 | 319 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
320 |
def test_delete_relation1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
321 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
322 |
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
|
323 |
{'x': ueid, 'y': ueid}, |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
324 |
{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
|
325 |
False) |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
326 |
|
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
327 |
def test_crossed_relation_eid_1_needattr(self): |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
328 |
repo._type_source_cache[999999] = ('Note', 'system', 999999) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
329 |
ueid = self.session.user.eid |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
330 |
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
|
331 |
{'x': 999999,}, |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
332 |
{self.cards: {'Y': s[0]}, self.system: {'Y': s[0], 'x': s[0]}}, |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
333 |
True) |
1785 | 334 |
|
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
335 |
def test_crossed_relation_eid_1_invariant(self): |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
336 |
repo._type_source_cache[999999] = ('Note', 'system', 999999) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
337 |
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
|
338 |
{'x': 999999}, |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
339 |
{self.system: {'Y': s[0], 'x': s[0]}}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
340 |
False) |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
341 |
|
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
342 |
def test_crossed_relation_eid_2_invariant(self): |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
343 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
344 |
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
|
345 |
{'x': 999999,}, |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
346 |
{self.cards: {'Y': s[0], 'multisource_crossed_rel': s[0], 'x': s[0]}, |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
347 |
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
|
348 |
False) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
349 |
|
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
350 |
def test_version_crossed_depends_on_1(self): |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
351 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
352 |
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
|
353 |
{'x': 999999}, |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
354 |
{self.cards: {'X': s[0], 'AD': s[0], 'multisource_crossed_rel': s[0], 'x': s[0]}, |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
355 |
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
|
356 |
True) |
1785 | 357 |
|
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
358 |
def test_version_crossed_depends_on_2(self): |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
359 |
repo._type_source_cache[999999] = ('Note', 'system', 999999) |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
360 |
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
|
361 |
{'x': 999999}, |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
362 |
{self.cards: {'X': s[0], 'AD': s[0]}, |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
363 |
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
|
364 |
True) |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
365 |
|
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
366 |
def test_simplified_var_3(self): |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
367 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
368 |
repo._type_source_cache[999998] = ('State', 'cards', 999998) |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
369 |
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
|
370 |
{'n': 999999, 's': 999998}, |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
371 |
{self.cards: {'s': s[0], 'N': s[0]}}, False) |
1785 | 372 |
|
373 |
||
332
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 |
class MSPlannerTC(BaseMSPlannerTC): |
1785 | 376 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
377 |
def setUp(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
378 |
BaseMSPlannerTC.setUp(self) |
3240
8604a15995d1
refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3239
diff
changeset
|
379 |
self.planner = MSPlanner(self.o.schema, self.repo.vreg.rqlhelper) |
6129
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
380 |
for cached in ('rel_type_sources', 'can_cross_relation', 'is_multi_sources_relation'): |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
381 |
clear_cache(self.repo, cached) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
382 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
383 |
_test = test_plan |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
384 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
385 |
def test_simple_system_only(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
386 |
"""retrieve entities only supported by the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
387 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
388 |
self._test('CWGroup X', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
389 |
[('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
|
390 |
None, None, [self.system], {}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
391 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
392 |
def test_simple_system_only_limit(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
393 |
"""retrieve entities only supported by the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
394 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
395 |
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
|
396 |
[('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
|
397 |
10, None, [self.system], {}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
398 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
399 |
def test_simple_system_only_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
400 |
"""retrieve entities only supported by the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
401 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
402 |
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
|
403 |
[('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
|
404 |
10, 10, [self.system], {}, [])]) |
1785 | 405 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
406 |
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
|
407 |
"""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
|
408 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
409 |
self._test('CWUser X', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
410 |
[('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
|
411 |
None, None, [self.ldap, self.system], {}, [])]) |
1785 | 412 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
413 |
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
|
414 |
"""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
|
415 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
416 |
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
|
417 |
[('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
|
418 |
10, None, [self.ldap, self.system], {}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
419 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
420 |
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
|
421 |
"""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
|
422 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
423 |
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
|
424 |
[('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
|
425 |
10, 10, [self.ldap, self.system], {}, [])]) |
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 |
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
|
428 |
"""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
|
429 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
430 |
self._test('CWUser X ORDERBY X LIMIT 10 OFFSET 10', |
5768
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
431 |
[('AggrStep', 'SELECT table0.C0 FROM table0 ORDER BY table0.C0 LIMIT 10 OFFSET 10', None, [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
432 |
('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
|
433 |
[self.ldap, self.system], {}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
434 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
435 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
436 |
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
|
437 |
"""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
|
438 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
439 |
# 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
|
440 |
self._test('Any COUNT(X) WHERE X is CWUser', |
5768
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
441 |
[('AggrStep', 'SELECT SUM(table0.C0) FROM table0', None, [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
442 |
('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
|
443 |
[self.ldap, self.system], {}, {'COUNT(X)': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
444 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
445 |
]) |
1785 | 446 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
447 |
def test_simple_system_rql(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
448 |
"""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
|
449 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
450 |
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
|
451 |
[('OneFetchStep', [('Any X,XT WHERE X is Card, X title XT', [{'X': 'Card', 'XT': 'String'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
452 |
None, None, [self.cards, self.system], {}, [])]) |
1785 | 453 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
454 |
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
|
455 |
"""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
|
456 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
457 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
458 |
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
|
459 |
[('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
|
460 |
None, None, [self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
461 |
{'x': ueid}) |
1785 | 462 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
463 |
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
|
464 |
"""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
|
465 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
466 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
467 |
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
|
468 |
[('OneFetchStep', [('Any %s'%ueid, [{}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
469 |
None, None, [self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
470 |
{'x': ueid}) |
1785 | 471 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
472 |
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
|
473 |
"""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
|
474 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
475 |
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
|
476 |
[('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
|
477 |
[{'X': 'CWUser', 'G': 'CWGroup'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
478 |
None, None, [self.system], {}, [])]) |
1785 | 479 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
480 |
def test_complex_base(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
481 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
482 |
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
|
483 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
484 |
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
|
485 |
G name 'users' on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
486 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
487 |
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
|
488 |
[('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
|
489 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
490 |
{'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
|
491 |
('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
|
492 |
[{'X': 'CWUser', 'L': 'String', 'G': 'CWGroup'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
493 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
494 |
{'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
|
495 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
496 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
497 |
def test_complex_base_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
498 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
499 |
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
|
500 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
501 |
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
|
502 |
G name 'users' on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
503 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
504 |
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
|
505 |
[('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
|
506 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
507 |
{'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
|
508 |
('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
|
509 |
[{'X': 'CWUser', 'L': 'String', 'G': 'CWGroup'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
510 |
10, 10, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
511 |
[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
|
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 |
def test_complex_ordered(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
515 |
self._test('Any L ORDERBY L WHERE X login L', |
5768
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
516 |
[('AggrStep', 'SELECT table0.C0 FROM table0 ORDER BY table0.C0', None, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
517 |
[('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
|
518 |
[{'X': 'CWUser', 'L': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
519 |
[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
|
520 |
]) |
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 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
523 |
def test_complex_ordered_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
524 |
self._test('Any L ORDERBY L LIMIT 10 OFFSET 10 WHERE X login L', |
5768
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
525 |
[('AggrStep', 'SELECT table0.C0 FROM table0 ORDER BY table0.C0 LIMIT 10 OFFSET 10', None, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
526 |
[('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
|
527 |
[{'X': 'CWUser', 'L': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
528 |
[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
|
529 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
530 |
]) |
1785 | 531 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
532 |
def test_complex_invariant_ordered(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
533 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
534 |
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
|
535 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
536 |
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
|
537 |
on the system source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
538 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
539 |
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
|
540 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
541 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
542 |
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
|
543 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
544 |
[('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
|
545 |
[{'AA': 'Datetime', 'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
546 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
547 |
{'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
|
548 |
('OneFetchStep', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
549 |
[('Any X,AA ORDERBY AA WHERE %s owned_by X, X modification_date AA, X is CWUser' % ueid, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
550 |
[{'AA': 'Datetime', 'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
551 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
552 |
{'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
|
553 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
554 |
{'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
555 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
556 |
def test_complex_invariant(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
557 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
558 |
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
|
559 |
concatenation of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
560 |
2. return the result of Any X,L,AA WHERE %s owned_by X, X login L, X modification_date AA |
1785 | 561 |
on the system source |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
562 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
563 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
564 |
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
|
565 |
[('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
|
566 |
[{'AA': 'Datetime', 'X': 'CWUser', 'L': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
567 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
568 |
{'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
|
569 |
('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
|
570 |
[{'AA': 'Datetime', 'X': 'CWUser', 'L': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
571 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
572 |
{'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
|
573 |
{'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
574 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
575 |
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
|
576 |
"""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
|
577 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
578 |
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
|
579 |
[('UnionStep', None, None, [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
580 |
('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
|
581 |
[{'X': 'CWUser', 'F': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
582 |
None, None, [self.ldap, self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
583 |
('OneFetchStep', [('Any X,F WHERE X firstname F, X is Personne', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
584 |
[{'X': 'Personne', 'F': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
585 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
586 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
587 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
588 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
589 |
def test_complex_ambigous_limit_offset(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
590 |
"""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
|
591 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
592 |
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
|
593 |
[('UnionStep', 10, 10, [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
594 |
('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
|
595 |
[{'X': 'CWUser', 'F': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
596 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
597 |
[self.ldap, self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
598 |
('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
|
599 |
[{'X': 'Personne', 'F': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
600 |
None, None, [self.system], {}, []), |
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 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
603 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
604 |
def test_complex_ambigous_ordered(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
605 |
""" |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
606 |
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
|
607 |
each result in the same temp table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
608 |
2. return content of the table sorted |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
609 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
610 |
self._test('Any X,F ORDERBY F WHERE X firstname F', |
5768
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
611 |
[('AggrStep', 'SELECT table0.C0, table0.C1 FROM table0 ORDER BY table0.C1', None, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
612 |
[('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
|
613 |
[{'X': 'CWUser', 'F': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
614 |
[self.ldap, self.system], {}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
615 |
{'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
|
616 |
('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
|
617 |
[{'X': 'Personne', 'F': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
618 |
[self.system], {}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
619 |
{'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
|
620 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
621 |
]) |
1785 | 622 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
623 |
def test_complex_multiple(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
624 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
625 |
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
|
626 |
cartesian product of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
627 |
2. return the result of Any X,Y WHERE X login 'syt', Y login 'adim' |
1785 | 628 |
on the system source |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
629 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
630 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
631 |
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
|
632 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
633 |
[('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
|
634 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
635 |
{'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
636 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
637 |
[('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
|
638 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
639 |
{'Y': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
640 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
641 |
[('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
|
642 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
643 |
{'X': 'table0.C0', 'Y': 'table1.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
644 |
], {'x': ueid}) |
1785 | 645 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
646 |
def test_complex_multiple_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
647 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
648 |
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
|
649 |
cartesian product of results into a temporary table |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
650 |
2. return the result of Any X,Y WHERE X login 'syt', Y login 'adim' |
1785 | 651 |
on the system source |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
652 |
""" |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
653 |
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
|
654 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
655 |
[('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
|
656 |
[self.ldap, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
657 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
658 |
[('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
|
659 |
[self.ldap, self.system], None, {'Y': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
660 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
661 |
[('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
|
662 |
10, 10, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
663 |
{'X': 'table0.C0', 'Y': 'table1.C0'}, []) |
5420
09b50d7e5321
[ms] fix planning bug with rewritten constants: when removing some source for a const due to relation constraints, we should propagate this change to other constants coming from the same original variable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4915
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_aggregat(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
667 |
self._test('Any MAX(X)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
668 |
[('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
669 |
[('Any MAX(X)', X_ALL_SOLS)], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
670 |
None, None, [self.system], {}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
671 |
]) |
1785 | 672 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
673 |
def test_complex_typed_aggregat(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
674 |
self._test('Any MAX(X) WHERE X is Card', |
5768
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
675 |
[('AggrStep', 'SELECT MAX(table0.C0) FROM table0', None, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
676 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
677 |
[('Any MAX(X) WHERE X is Card', [{'X': 'Card'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
678 |
[self.cards, self.system], {}, {'MAX(X)': 'table0.C0'}, []) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
679 |
]) |
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_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', |
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_ALL_SOLS)], |
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_greater_typed_eid(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
690 |
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
|
691 |
[('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
692 |
[('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
|
693 |
None, None, [self.system], {}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
694 |
]) |
1785 | 695 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
696 |
def test_complex_optional(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
697 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
698 |
self._test('Any U WHERE WF wf_info_for X, X eid %(x)s, WF owned_by U?, WF from_state FS', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
699 |
[('OneFetchStep', [('Any U WHERE WF wf_info_for %s, WF owned_by U?, WF from_state FS' % ueid, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
700 |
[{'WF': 'TrInfo', 'FS': 'State', 'U': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
701 |
None, None, [self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
702 |
{'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
703 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
704 |
def test_complex_optional(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
705 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
706 |
self._test('Any U WHERE WF wf_info_for X, X eid %(x)s, WF owned_by U?, WF from_state FS', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
707 |
[('OneFetchStep', [('Any U WHERE WF wf_info_for %s, WF owned_by U?, WF from_state FS' % ueid, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
708 |
[{'WF': 'TrInfo', 'FS': 'State', 'U': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
709 |
None, None, [self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
710 |
{'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
711 |
|
1785 | 712 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
713 |
def test_3sources_ambigous(self): |
3587 | 714 |
self._test('Any X,T WHERE X owned_by U, U login "syt", X title T, X is IN(Bookmark, Card, EmailThread)', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
715 |
[('FetchStep', [('Any X,T WHERE X title T, X is Card', [{'X': 'Card', 'T': 'String'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
716 |
[self.cards, self.system], None, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
717 |
{'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
|
718 |
('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
|
719 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
720 |
{'U': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
721 |
('UnionStep', None, None, [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
722 |
('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
|
723 |
[{'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
|
724 |
{'T': 'String', 'U': 'CWUser', 'X': 'EmailThread'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
725 |
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
|
726 |
('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
|
727 |
[{'X': 'Card', 'U': 'CWUser', 'T': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
728 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
729 |
{'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
|
730 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
731 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
732 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
733 |
def test_restricted_max(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
734 |
# 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
|
735 |
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
|
736 |
'(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
|
737 |
'X is Card, X creation_date < TODAY, X creation_date >= VR)))', |
3815
50b87f759b5d
test and fix http://www.logilab.org/ticket/499838
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3689
diff
changeset
|
738 |
[('FetchStep', [('Any VR WHERE X creation_date < TODAY, X creation_date VR, X is Card', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
739 |
[{'X': 'Card', 'VR': 'Datetime'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
740 |
[self.cards, self.system], None, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
741 |
{'VR': 'table0.C0', 'X.creation_date': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
742 |
('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
|
743 |
[{'VR': 'Datetime', 'V': 'Card'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
744 |
[self.cards, self.system], None, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
745 |
{'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
|
746 |
('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
|
747 |
[{'X': 'Card', 'VR': 'Datetime', 'V': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
748 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
749 |
{'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
|
750 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
751 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
752 |
def test_outer_supported_rel1(self): |
1785 | 753 |
# 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
|
754 |
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
|
755 |
'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
|
756 |
[('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
|
757 |
[{'Y': 'Note', 'X': 'Note', 'S': 'State', 'R': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
758 |
None, None, |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
759 |
[self.cards, self.system], {}, []) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
760 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
761 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
762 |
def test_not_identity(self): |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
763 |
ueid = self.session.user.eid |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
764 |
self._test('Any X WHERE NOT X identity U, U eid %s' % ueid, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
765 |
[('OneFetchStep', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
766 |
[('Any X WHERE NOT X identity %s, X is CWUser' % ueid, [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
767 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
768 |
[self.ldap, self.system], {}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
769 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
770 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
771 |
def test_outer_supported_rel2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
772 |
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
|
773 |
'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
|
774 |
[('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
|
775 |
[{'Y': 'Note', 'A': 'State', 'R': 'String'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
776 |
[self.cards, self.system], None, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
777 |
{'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
|
778 |
('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
|
779 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
780 |
{'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
|
781 |
('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
|
782 |
[{'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
|
783 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
784 |
{'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
|
785 |
]) |
1785 | 786 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
787 |
def test_security_has_text(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
788 |
# use a guest user |
4674
3d509dbb473a
[test api] rename _user_session to user_groups_session, fix its arguments and return only the session, not (user, session) to make things clearer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
789 |
self.session = self.user_groups_session('guests') |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
790 |
ueid = self.session.user.eid |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
791 |
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
|
792 |
[('FetchStep', [('Any E WHERE E type "X", E is Note', [{'E': 'Note'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
793 |
[self.cards, self.system], None, {'E': 'table0.C0'}, []), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
794 |
('UnionStep', None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
795 |
[('OneFetchStep', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
796 |
[(u'Any X WHERE X has_text "bla", (EXISTS(X owned_by %(ueid)s)) OR ((((EXISTS(D concerne C?, C owned_by %(ueid)s, C type "X", X identity D, C is Division, D is Affaire)) OR (EXISTS(H concerne G?, G owned_by %(ueid)s, G type "X", X identity H, G is SubDivision, H is Affaire))) OR (EXISTS(I concerne F?, F owned_by %(ueid)s, F type "X", X identity I, F is Societe, I is Affaire))) OR (EXISTS(J concerne E?, E owned_by %(ueid)s, X identity J, E is Note, J is Affaire))), X is Affaire' % {'ueid': ueid}, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
797 |
[{'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
|
798 |
None, None, [self.system], {'E': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
799 |
('OneFetchStep', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
800 |
[('Any X WHERE X has_text "bla", EXISTS(X owned_by %s), X is Basket' % ueid, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
801 |
[{'X': 'Basket'}]), |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
802 |
('Any X WHERE X has_text "bla", EXISTS(X owned_by %s), X is CWUser' % ueid, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
803 |
[{'X': 'CWUser'}]), |
5575
8a531340c3ef
no more Image type w/ cw 3.9
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5556
diff
changeset
|
804 |
('Any X WHERE X has_text "bla", X is IN(Card, Comment, Division, Email, EmailThread, File, Folder, Note, Personne, Societe, SubDivision, Tag)', |
4815
4ee224c4c41d
update test broken by fulltextindexed change on workflow entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
805 |
[{'X': 'Card'}, {'X': 'Comment'}, |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
806 |
{'X': 'Division'}, {'X': 'Email'}, {'X': 'EmailThread'}, |
5575
8a531340c3ef
no more Image type w/ cw 3.9
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5556
diff
changeset
|
807 |
{'X': 'File'}, {'X': 'Folder'}, |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
808 |
{'X': 'Note'}, {'X': 'Personne'}, {'X': 'Societe'}, |
4815
4ee224c4c41d
update test broken by fulltextindexed change on workflow entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
809 |
{'X': 'SubDivision'}, {'X': 'Tag'}]),], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
810 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
811 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
812 |
]) |
1785 | 813 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
814 |
def test_security_has_text_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
815 |
# use a guest user |
4674
3d509dbb473a
[test api] rename _user_session to user_groups_session, fix its arguments and return only the session, not (user, session) to make things clearer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
816 |
self.session = self.user_groups_session('guests') |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
817 |
ueid = self.session.user.eid |
6676 | 818 |
# note: same as the above query but because of the subquery usage, the |
819 |
# display differs (not printing solutions for each union) |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
820 |
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
|
821 |
[('FetchStep', [('Any E WHERE E type "X", E is Note', [{'E': 'Note'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
822 |
[self.cards, self.system], None, {'E': 'table1.C0'}, []), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
823 |
('UnionFetchStep', [ |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
824 |
('FetchStep', [('Any X WHERE X has_text "bla", (EXISTS(X owned_by %(ueid)s)) OR ((((EXISTS(D concerne C?, C owned_by %(ueid)s, C type "X", X identity D, C is Division, D is Affaire)) OR (EXISTS(H concerne G?, G owned_by %(ueid)s, G type "X", X identity H, G is SubDivision, H is Affaire))) OR (EXISTS(I concerne F?, F owned_by %(ueid)s, F type "X", X identity I, F is Societe, I is Affaire))) OR (EXISTS(J concerne E?, E owned_by %(ueid)s, X identity J, E is Note, J is Affaire))), X is Affaire' % {'ueid': ueid}, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
825 |
[{'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
|
826 |
[self.system], {'E': 'table1.C0'}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
827 |
('FetchStep', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
828 |
[('Any X WHERE X has_text "bla", EXISTS(X owned_by %s), X is Basket' % ueid, |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
829 |
[{'X': 'Basket'}]), |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
830 |
('Any X WHERE X has_text "bla", EXISTS(X owned_by %s), X is CWUser' % ueid, |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
831 |
[{'X': 'CWUser'}]), |
5575
8a531340c3ef
no more Image type w/ cw 3.9
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5556
diff
changeset
|
832 |
('Any X WHERE X has_text "bla", X is IN(Card, Comment, Division, Email, EmailThread, File, Folder, Note, Personne, Societe, SubDivision, Tag)', |
4815
4ee224c4c41d
update test broken by fulltextindexed change on workflow entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
833 |
[{'X': 'Card'}, {'X': 'Comment'}, |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
834 |
{'X': 'Division'}, {'X': 'Email'}, {'X': 'EmailThread'}, |
5575
8a531340c3ef
no more Image type w/ cw 3.9
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5556
diff
changeset
|
835 |
{'X': 'File'}, {'X': 'Folder'}, |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
836 |
{'X': 'Note'}, {'X': 'Personne'}, {'X': 'Societe'}, |
4815
4ee224c4c41d
update test broken by fulltextindexed change on workflow entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
837 |
{'X': 'SubDivision'}, {'X': 'Tag'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
838 |
[self.system], {}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
839 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
840 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
841 |
[('Any X LIMIT 10 OFFSET 10', |
4815
4ee224c4c41d
update test broken by fulltextindexed change on workflow entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
842 |
[{'X': 'Affaire'}, {'X': 'Basket'}, |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
843 |
{'X': 'CWUser'}, {'X': 'Card'}, {'X': 'Comment'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
844 |
{'X': 'Division'}, {'X': 'Email'}, {'X': 'EmailThread'}, |
5575
8a531340c3ef
no more Image type w/ cw 3.9
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5556
diff
changeset
|
845 |
{'X': 'File'}, {'X': 'Folder'}, |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
846 |
{'X': 'Note'}, {'X': 'Personne'}, {'X': 'Societe'}, |
4815
4ee224c4c41d
update test broken by fulltextindexed change on workflow entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
847 |
{'X': 'SubDivision'}, {'X': 'Tag'}])], |
1785 | 848 |
10, 10, [self.system], {'X': 'table0.C0'}, []) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
849 |
]) |
1785 | 850 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
851 |
def test_security_user(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
852 |
"""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
|
853 |
# use a guest user |
4674
3d509dbb473a
[test api] rename _user_session to user_groups_session, fix its arguments and return only the session, not (user, session) to make things clearer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
854 |
self.session = self.user_groups_session('guests') |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
855 |
ueid = self.session.user.eid |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
856 |
self._test('Any X WHERE X login "bla"', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
857 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
858 |
[('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
|
859 |
[self.ldap, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
860 |
('OneFetchStep', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
861 |
[('Any X WHERE EXISTS(X owned_by %s), X is CWUser' % ueid, [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
862 |
None, None, [self.system], {'X': 'table0.C0'}, [])]) |
1785 | 863 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
864 |
def test_security_complex_has_text(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
865 |
# use a guest user |
4674
3d509dbb473a
[test api] rename _user_session to user_groups_session, fix its arguments and return only the session, not (user, session) to make things clearer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
866 |
self.session = self.user_groups_session('guests') |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
867 |
ueid = self.session.user.eid |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
868 |
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
|
869 |
[('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
|
870 |
[self.ldap, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
871 |
('UnionStep', None, None, [ |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
872 |
('OneFetchStep', [('Any X WHERE X has_text "bla", EXISTS(X owned_by %s), X is CWUser' % ueid, [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
873 |
None, None, [self.system], {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
874 |
('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
|
875 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
876 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
877 |
]) |
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 |
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
|
880 |
# use a guest user |
4674
3d509dbb473a
[test api] rename _user_session to user_groups_session, fix its arguments and return only the session, not (user, session) to make things clearer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
881 |
self.session = self.user_groups_session('guests') |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
882 |
ueid = self.session.user.eid |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
883 |
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
|
884 |
[('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
|
885 |
[self.ldap, self.system], None, {'X': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
886 |
('UnionFetchStep', [ |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
887 |
('FetchStep', [('Any X WHERE X has_text "bla", EXISTS(X owned_by %s), X is CWUser' % ueid, [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
888 |
[self.system], {'X': 'table1.C0'}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
889 |
('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
|
890 |
[self.system], {}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
891 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
892 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
893 |
[('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
|
894 |
10, 10, [self.system], {'X': 'table0.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
895 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
896 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
897 |
def test_security_complex_aggregat(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
898 |
# use a guest user |
4674
3d509dbb473a
[test api] rename _user_session to user_groups_session, fix its arguments and return only the session, not (user, session) to make things clearer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
899 |
self.session = self.user_groups_session('guests') |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
900 |
ueid = self.session.user.eid |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
901 |
ALL_SOLS = X_ALL_SOLS[:] |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
902 |
ALL_SOLS.remove({'X': 'CWSourceHostConfig'}) # not authorized |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
903 |
self._test('Any MAX(X)', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
904 |
[('FetchStep', [('Any E WHERE E type "X", E is Note', [{'E': 'Note'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
905 |
[self.cards, 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
|
906 |
('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
|
907 |
[self.ldap, self.system], None, {'X': 'table2.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
908 |
('UnionFetchStep', [ |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
909 |
('FetchStep', [('Any X WHERE EXISTS(X owned_by %s), X is Basket' % ueid, [{'X': 'Basket'}])], |
1785 | 910 |
[self.system], {}, {'X': 'table0.C0'}, []), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
911 |
('UnionFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
912 |
[('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
|
913 |
[{'X': 'Card'}, {'X': 'Note'}, {'X': 'State'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
914 |
[self.cards, self.system], {}, {'X': 'table0.C0'}, []), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
915 |
('FetchStep', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
916 |
[('Any X WHERE X is IN(BaseTransition, Bookmark, CWAttribute, CWCache, CWConstraint, CWConstraintType, CWEType, CWGroup, CWPermission, CWProperty, CWRType, CWRelation, CWSource, CWUniqueTogetherConstraint, Comment, Division, Email, EmailAddress, EmailPart, EmailThread, ExternalUri, File, Folder, Personne, RQLExpression, Societe, SubDivision, SubWorkflowExitPoint, Tag, TrInfo, Transition, Workflow, WorkflowTransition)', |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
917 |
[{'X': 'BaseTransition'}, {'X': 'Bookmark'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
918 |
{'X': 'CWAttribute'}, {'X': 'CWCache'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
919 |
{'X': 'CWConstraint'}, {'X': 'CWConstraintType'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
920 |
{'X': 'CWEType'}, {'X': 'CWGroup'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
921 |
{'X': 'CWPermission'}, {'X': 'CWProperty'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
922 |
{'X': 'CWRType'}, {'X': 'CWRelation'}, |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
923 |
{'X': 'CWSource'}, |
6209 | 924 |
{'X': 'CWUniqueTogetherConstraint'}, |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
925 |
{'X': 'Comment'}, {'X': 'Division'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
926 |
{'X': 'Email'}, {'X': 'EmailAddress'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
927 |
{'X': 'EmailPart'}, {'X': 'EmailThread'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
928 |
{'X': 'ExternalUri'}, {'X': 'File'}, |
5575
8a531340c3ef
no more Image type w/ cw 3.9
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5556
diff
changeset
|
929 |
{'X': 'Folder'}, |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
930 |
{'X': 'Personne'}, {'X': 'RQLExpression'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
931 |
{'X': 'Societe'}, {'X': 'SubDivision'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
932 |
{'X': 'SubWorkflowExitPoint'}, {'X': 'Tag'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
933 |
{'X': 'TrInfo'}, {'X': 'Transition'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
934 |
{'X': 'Workflow'}, {'X': 'WorkflowTransition'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
935 |
[self.system], {}, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
936 |
]), |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
937 |
('FetchStep', [('Any X WHERE EXISTS(X owned_by %s), X is CWUser' % ueid, [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
938 |
[self.system], {'X': 'table2.C0'}, {'X': 'table0.C0'}, []), |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
939 |
('FetchStep', [('Any X WHERE (EXISTS(X owned_by %(ueid)s)) OR ((((EXISTS(D concerne C?, C owned_by %(ueid)s, C type "X", X identity D, C is Division, D is Affaire)) OR (EXISTS(H concerne G?, G owned_by %(ueid)s, G type "X", X identity H, G is SubDivision, H is Affaire))) OR (EXISTS(I concerne F?, F owned_by %(ueid)s, F type "X", X identity I, F is Societe, I is Affaire))) OR (EXISTS(J concerne E?, E owned_by %(ueid)s, X identity J, E is Note, J is Affaire))), X is Affaire' % {'ueid': ueid}, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
940 |
[{'C': 'Division', 'E': 'Note', 'D': 'Affaire', 'G': 'SubDivision', 'F': 'Societe', 'I': 'Affaire', 'H': 'Affaire', 'J': 'Affaire', 'X': 'Affaire'}])], |
1785 | 941 |
[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
|
942 |
]), |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
943 |
('OneFetchStep', [('Any MAX(X)', ALL_SOLS)], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
944 |
None, None, [self.system], {'X': 'table0.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
945 |
]) |
1785 | 946 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
947 |
def test_security_complex_aggregat2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
948 |
# use a guest user |
4674
3d509dbb473a
[test api] rename _user_session to user_groups_session, fix its arguments and return only the session, not (user, session) to make things clearer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
949 |
self.session = self.user_groups_session('guests') |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
950 |
ueid = self.session.user.eid |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
951 |
X_ET_ALL_SOLS = [] |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
952 |
for s in X_ALL_SOLS: |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
953 |
if s == {'X': 'CWSourceHostConfig'}: |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
954 |
continue # not authorized |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
955 |
ets = {'ET': 'CWEType'} |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
956 |
ets.update(s) |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
957 |
X_ET_ALL_SOLS.append(ets) |
1785 | 958 |
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
|
959 |
[('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
|
960 |
[{'X': 'Card'}, {'X': 'Note'}, {'X': 'State'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
961 |
[self.cards, self.system], None, {'X': 'table1.C0'}, []), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
962 |
('FetchStep', [('Any E WHERE E type "X", E is Note', [{'E': 'Note'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
963 |
[self.cards, 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
|
964 |
('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
|
965 |
[self.ldap, self.system], None, {'X': 'table3.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
966 |
('UnionFetchStep', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
967 |
[('FetchStep', [('Any ET,X WHERE X is ET, EXISTS(X owned_by %s), ET is CWEType, X is Basket' % ueid, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
968 |
[{'ET': 'CWEType', 'X': 'Basket'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
969 |
[self.system], {}, {'ET': 'table0.C0', 'X': 'table0.C1'}, []), |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
970 |
('FetchStep', [('Any ET,X WHERE X is ET, (EXISTS(X owned_by %(ueid)s)) OR ((((EXISTS(D concerne C?, C owned_by %(ueid)s, C type "X", X identity D, C is Division, D is Affaire)) OR (EXISTS(H concerne G?, G owned_by %(ueid)s, G type "X", X identity H, G is SubDivision, H is Affaire))) OR (EXISTS(I concerne F?, F owned_by %(ueid)s, F type "X", X identity I, F is Societe, I is Affaire))) OR (EXISTS(J concerne E?, E owned_by %(ueid)s, X identity J, E is Note, J is Affaire))), ET is CWEType, X is Affaire' % {'ueid': ueid}, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
971 |
[{'C': 'Division', 'E': 'Note', 'D': 'Affaire', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
972 |
'G': 'SubDivision', 'F': 'Societe', 'I': 'Affaire', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
973 |
'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
|
974 |
'ET': 'CWEType'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
975 |
[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
|
976 |
[]), |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
977 |
('FetchStep', [('Any ET,X WHERE X is ET, EXISTS(X owned_by %s), ET is CWEType, X is CWUser' % ueid, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
978 |
[{'ET': 'CWEType', 'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
979 |
[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
|
980 |
# 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
|
981 |
('UnionFetchStep', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
982 |
[('FetchStep', [('Any ET,X WHERE X is ET, ET is CWEType, X is IN(BaseTransition, Bookmark, CWAttribute, CWCache, CWConstraint, CWConstraintType, CWEType, CWGroup, CWPermission, CWProperty, CWRType, CWRelation, CWSource, CWUniqueTogetherConstraint, Comment, Division, Email, EmailAddress, EmailPart, EmailThread, ExternalUri, File, Folder, Personne, RQLExpression, Societe, SubDivision, SubWorkflowExitPoint, Tag, TrInfo, Transition, Workflow, WorkflowTransition)', |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
983 |
[{'X': 'BaseTransition', 'ET': 'CWEType'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
984 |
{'X': 'Bookmark', 'ET': 'CWEType'}, {'X': 'CWAttribute', 'ET': 'CWEType'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
985 |
{'X': 'CWCache', 'ET': 'CWEType'}, {'X': 'CWConstraint', 'ET': 'CWEType'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
986 |
{'X': 'CWConstraintType', 'ET': 'CWEType'}, {'X': 'CWEType', 'ET': 'CWEType'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
987 |
{'X': 'CWGroup', 'ET': 'CWEType'}, {'X': 'CWPermission', 'ET': 'CWEType'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
988 |
{'X': 'CWProperty', 'ET': 'CWEType'}, {'X': 'CWRType', 'ET': 'CWEType'}, |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
989 |
{'X': 'CWSource', 'ET': 'CWEType'}, |
6209 | 990 |
{'X': 'CWRelation', 'ET': 'CWEType'}, |
991 |
{'X': 'CWUniqueTogetherConstraint', 'ET': 'CWEType'}, |
|
992 |
{'X': 'Comment', 'ET': 'CWEType'}, |
|
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
993 |
{'X': 'Division', 'ET': 'CWEType'}, {'X': 'Email', 'ET': 'CWEType'}, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
994 |
{'X': 'EmailAddress', 'ET': 'CWEType'}, {'X': 'EmailPart', 'ET': 'CWEType'}, |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
995 |
{'X': 'EmailThread', 'ET': 'CWEType'}, {'X': 'ExternalUri', 'ET': 'CWEType'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
996 |
{'X': 'File', 'ET': 'CWEType'}, {'X': 'Folder', 'ET': 'CWEType'}, |
5575
8a531340c3ef
no more Image type w/ cw 3.9
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5556
diff
changeset
|
997 |
{'X': 'Personne', 'ET': 'CWEType'}, |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
998 |
{'X': 'RQLExpression', 'ET': 'CWEType'}, {'X': 'Societe', 'ET': 'CWEType'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
999 |
{'X': 'SubDivision', 'ET': 'CWEType'}, {'X': 'SubWorkflowExitPoint', 'ET': 'CWEType'}, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1000 |
{'X': 'Tag', 'ET': 'CWEType'}, {'X': 'TrInfo', 'ET': 'CWEType'}, |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
1001 |
{'X': 'Transition', 'ET': 'CWEType'}, {'X': 'Workflow', 'ET': 'CWEType'}, |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
1002 |
{'X': 'WorkflowTransition', 'ET': 'CWEType'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1003 |
[self.system], {}, {'ET': 'table0.C0', 'X': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1004 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1005 |
[('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
|
1006 |
[{'ET': 'CWEType', 'X': 'Card'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1007 |
{'ET': 'CWEType', 'X': 'Note'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1008 |
{'ET': 'CWEType', 'X': 'State'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1009 |
[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
|
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 |
('OneFetchStep', |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2715
diff
changeset
|
1013 |
[('Any ET,COUNT(X) GROUPBY ET ORDERBY ET', X_ET_ALL_SOLS)], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1014 |
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
|
1015 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1016 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1017 |
def test_security_3sources(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1018 |
# use a guest user |
4674
3d509dbb473a
[test api] rename _user_session to user_groups_session, fix its arguments and return only the session, not (user, session) to make things clearer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
1019 |
self.session = self.user_groups_session('guests') |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1020 |
ueid = self.session.user.eid |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1021 |
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
|
1022 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1023 |
[('Any X,XT WHERE X title XT, X is Card', [{'X': 'Card', 'XT': 'String'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1024 |
[self.cards, self.system], None, {'X': 'table0.C0', 'X.title': 'table0.C1', 'XT': 'table0.C1'}, []), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1025 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1026 |
[('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
|
1027 |
[self.ldap, self.system], None, {'U': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1028 |
('OneFetchStep', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1029 |
[('Any X,XT WHERE X owned_by U, X title XT, EXISTS(U owned_by %s), U is CWUser, X is Card' % ueid, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1030 |
[{'X': 'Card', 'U': 'CWUser', 'XT': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1031 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1032 |
{'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
|
1033 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1034 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1035 |
def test_security_3sources_identity(self): |
4191
01638461d4b0
test update. All cw tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3890
diff
changeset
|
1036 |
self.restore_orig_cwuser_security() |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1037 |
# use a guest user |
4674
3d509dbb473a
[test api] rename _user_session to user_groups_session, fix its arguments and return only the session, not (user, session) to make things clearer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
1038 |
self.session = self.user_groups_session('guests') |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1039 |
ueid = self.session.user.eid |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1040 |
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
|
1041 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1042 |
[('Any X,XT WHERE X title XT, X is Card', [{'X': 'Card', 'XT': 'String'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1043 |
[self.cards, self.system], None, {'X': 'table0.C0', 'X.title': 'table0.C1', 'XT': 'table0.C1'}, []), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1044 |
('OneFetchStep', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1045 |
[('Any X,XT WHERE X owned_by U, X title XT, U login "syt", EXISTS(U identity %s), U is CWUser, X is Card' % ueid, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1046 |
[{'U': 'CWUser', 'X': 'Card', 'XT': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1047 |
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
|
1048 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1049 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1050 |
def test_security_3sources_identity_optional_var(self): |
4191
01638461d4b0
test update. All cw tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3890
diff
changeset
|
1051 |
self.restore_orig_cwuser_security() |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1052 |
# use a guest user |
4674
3d509dbb473a
[test api] rename _user_session to user_groups_session, fix its arguments and return only the session, not (user, session) to make things clearer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
1053 |
self.session = self.user_groups_session('guests') |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1054 |
ueid = self.session.user.eid |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1055 |
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
|
1056 |
[('FetchStep', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1057 |
[('Any U,L WHERE U login L, EXISTS(U identity %s), U is CWUser' % ueid, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1058 |
[{'L': 'String', u'U': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1059 |
[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
|
1060 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1061 |
[('Any X,XT WHERE X title XT, X is Card', [{'X': 'Card', 'XT': 'String'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1062 |
[self.cards, self.system], None, {'X': 'table1.C0', 'X.title': 'table1.C1', 'XT': 'table1.C1'}, []), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1063 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1064 |
[('Any X,XT,U WHERE X owned_by U?, X title XT, X is Card', |
6129
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1065 |
[{'X': 'Card', 'U': 'CWUser', 'XT': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1066 |
None, None, [self.system], {'L': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1067 |
'U': 'table0.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1068 |
'X': 'table1.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1069 |
'X.title': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1070 |
'XT': 'table1.C1'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1071 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1072 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1073 |
def test_security_3sources_limit_offset(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1074 |
# use a guest user |
4674
3d509dbb473a
[test api] rename _user_session to user_groups_session, fix its arguments and return only the session, not (user, session) to make things clearer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
1075 |
self.session = self.user_groups_session('guests') |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1076 |
ueid = self.session.user.eid |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1077 |
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
|
1078 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1079 |
[('Any X,XT WHERE X title XT, X is Card', [{'X': 'Card', 'XT': 'String'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1080 |
[self.cards, self.system], None, {'X': 'table0.C0', 'X.title': 'table0.C1', 'XT': 'table0.C1'}, []), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1081 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1082 |
[('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
|
1083 |
[self.ldap, self.system], None, {'U': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1084 |
('OneFetchStep', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1085 |
[('Any X,XT LIMIT 10 OFFSET 10 WHERE X owned_by U, X title XT, EXISTS(U owned_by %s), U is CWUser, X is Card' % ueid, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1086 |
[{'X': 'Card', 'U': 'CWUser', 'XT': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1087 |
10, 10, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1088 |
{'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
|
1089 |
]) |
1785 | 1090 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1091 |
def test_exists_base(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1092 |
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
|
1093 |
[('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
|
1094 |
[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
|
1095 |
('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
|
1096 |
'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
|
1097 |
[{'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
|
1098 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1099 |
{'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
|
1100 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1101 |
def test_exists_complex(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1102 |
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
|
1103 |
[('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
|
1104 |
[self.ldap, self.system], None, {'T': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1105 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1106 |
[('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
|
1107 |
[{'X': 'CWUser', 'T': 'CWUser', 'G': 'CWGroup'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1108 |
None, None, [self.system], {'T': 'table0.C0'}, [])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1109 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1110 |
def test_exists3(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1111 |
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
|
1112 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1113 |
[('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
|
1114 |
[{'T': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1115 |
[self.ldap, self.system], None, {'T': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1116 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1117 |
[('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
|
1118 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1119 |
{'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
|
1120 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1121 |
[('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
|
1122 |
[{'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
|
1123 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1124 |
[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
|
1125 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1126 |
def test_exists4(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1127 |
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
|
1128 |
'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
|
1129 |
'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
|
1130 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1131 |
[('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
|
1132 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1133 |
{'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
|
1134 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1135 |
[('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
|
1136 |
[self.ldap, self.system], None, {'T2': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1137 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1138 |
[('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
|
1139 |
[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
|
1140 |
('OneFetchStep', |
5582
3e133b29a1a4
[rql2sql] follow rql 0.26.1 changes: NOT nodes normalization, allowing simplification of sql generation, and fix #XXX
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
1141 |
[('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 EXISTS(X copain T2), S is State)), G is CWGroup, T2 is CWUser, X is CWUser', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1142 |
[{'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
|
1143 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1144 |
{'T2': 'table1.C0', 'L': 'table2.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1145 |
'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
|
1146 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1147 |
def test_exists5(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1148 |
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
|
1149 |
'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
|
1150 |
'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
|
1151 |
[('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
|
1152 |
[{'T': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1153 |
[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
|
1154 |
('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
|
1155 |
[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
|
1156 |
('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
|
1157 |
[self.ldap, self.system], None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1158 |
{'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
|
1159 |
('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
|
1160 |
[{'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
|
1161 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1162 |
{'T': 'table0.C0', 'T2': 'table1.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1163 |
'X': 'table2.C1', 'X.login': 'table2.C0', 'L': 'table2.C0'}, [])]) |
1785 | 1164 |
|
392 | 1165 |
def test_exists_security_no_invariant(self): |
1166 |
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
|
1167 |
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 | 1168 |
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
|
1169 |
(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
|
1170 |
(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
|
1171 |
[('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 | 1172 |
[{'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
|
1173 |
'X': 'CWUser'}])], |
392 | 1174 |
[self.ldap, self.system], None, {'AA': 'table0.C1', 'AB': 'table0.C2', |
1175 |
'AC': 'table0.C3', 'AD': 'table0.C4', |
|
1176 |
'X': 'table0.C0', |
|
1177 |
'X.firstname': 'table0.C2', |
|
1178 |
'X.login': 'table0.C1', |
|
1179 |
'X.modification_date': 'table0.C4', |
|
1180 |
'X.surname': 'table0.C3'}, []), |
|
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1181 |
('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 %(ueid)s) OR (EXISTS(X in_group C, C name IN("managers", "staff"), C is CWGroup))) OR (EXISTS(X in_group D, %(ueid)s in_group D, NOT D name "users", D is CWGroup))), X is CWUser' % {'ueid': ueid}, |
392 | 1182 |
[{'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
|
1183 |
'C': 'CWGroup', 'D': 'CWGroup', 'X': 'CWUser'}])], |
392 | 1184 |
None, None, [self.system], |
1185 |
{'AA': 'table0.C1', 'AB': 'table0.C2', 'AC': 'table0.C3', 'AD': 'table0.C4', |
|
1186 |
'X': 'table0.C0', |
|
1187 |
'X.firstname': 'table0.C2', 'X.login': 'table0.C1', 'X.modification_date': 'table0.C4', 'X.surname': 'table0.C3'}, |
|
1188 |
[])], |
|
1189 |
{'B': ueid}) |
|
332
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_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1192 |
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
|
1193 |
[('UnionStep', None, None, [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1194 |
('OneFetchStep', [('Any X,S WHERE X in_state S, S is State, X is IN(Affaire, CWUser)', |
1785 | 1195 |
[{'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
|
1196 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1197 |
('OneFetchStep', [('Any X,S WHERE X in_state S, S is State, X is Note', |
1785 | 1198 |
[{'X': 'Note', 'S': 'State'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1199 |
None, None, [self.cards, self.system], {}, []), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1200 |
])]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1201 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1202 |
def test_relation_selection_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1203 |
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
|
1204 |
[('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
|
1205 |
[{'X': 'Note', 'S': 'State'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1206 |
[self.cards, self.system], None, {'X': 'table0.C0', 'S': 'table0.C1'}, []), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1207 |
('UnionStep', None, None, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1208 |
[('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
|
1209 |
[{'X': 'Note', 'S': 'State', 'U': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1210 |
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
|
1211 |
('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
|
1212 |
[{'X': 'Affaire', 'S': 'State', 'U': 'Personne'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1213 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1214 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1215 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1216 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1217 |
def test_relation_restriction_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1218 |
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
|
1219 |
[('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
|
1220 |
[{'X': 'Note', 'S': 'State'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1221 |
[self.cards, self.system], None, {'X': 'table0.C0'}, []), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1222 |
('UnionStep', None, None, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1223 |
[('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
|
1224 |
[{'X': 'Note', 'U': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1225 |
None, None, [self.system], {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1226 |
('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
|
1227 |
[{'S': 'State', 'U': 'Personne', 'X': 'Affaire'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1228 |
None, None, [self.system], {}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1229 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1230 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1231 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1232 |
def test_relation_restriction_ambigous_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1233 |
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
|
1234 |
[('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
|
1235 |
[{'X': 'Note', 'S': 'State'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1236 |
[self.cards, self.system], None, {'X': 'table0.C0'}, []), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1237 |
('UnionStep', None, None, [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1238 |
('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
|
1239 |
[{'X': 'Note', 'T': 'Tag'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1240 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1241 |
[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
|
1242 |
('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
|
1243 |
[{'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
|
1244 |
{'X': 'CWUser', 'S': 'State', 'T': 'Tag'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1245 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1246 |
[self.system], {}, []), |
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 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1249 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1250 |
def test_not_relation_no_split_internal(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1251 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1252 |
# 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
|
1253 |
# 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
|
1254 |
# 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
|
1255 |
# 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
|
1256 |
# generation for the external source |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1257 |
self._test('Any SN WHERE NOT X in_state S, X eid %(x)s, S name SN', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1258 |
[('OneFetchStep', [('Any SN WHERE NOT EXISTS(%s in_state S), S name SN, S is State' % ueid, |
1785 | 1259 |
[{'S': 'State', 'SN': 'String'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1260 |
None, None, [self.cards, self.system], {}, [])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1261 |
{'x': ueid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1262 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1263 |
def test_not_relation_no_split_external(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1264 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1265 |
# 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
|
1266 |
# the same plan may be used, since we won't find any record in the system source |
1785 | 1267 |
# linking 9999999 to a state |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1268 |
self._test('Any SN WHERE NOT X in_state S, X eid %(x)s, S name SN', |
5582
3e133b29a1a4
[rql2sql] follow rql 0.26.1 changes: NOT nodes normalization, allowing simplification of sql generation, and fix #XXX
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
1269 |
[('OneFetchStep', [('Any SN WHERE NOT EXISTS(999999 in_state S), S name SN, S is State', |
1785 | 1270 |
[{'S': 'State', 'SN': 'String'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1271 |
None, None, [self.cards, self.system], {}, [])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1272 |
{'x': 999999}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1273 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1274 |
def test_not_relation_need_split(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1275 |
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
|
1276 |
[('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
|
1277 |
[{'S': 'State', 'SN': 'String'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1278 |
[self.cards, self.system], None, {'S': 'table0.C1', 'S.name': 'table0.C0', 'SN': 'table0.C0'}, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1279 |
[]), |
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
|
1280 |
('IntersectStep', None, None, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1281 |
[('OneFetchStep', |
5582
3e133b29a1a4
[rql2sql] follow rql 0.26.1 changes: NOT nodes normalization, allowing simplification of sql generation, and fix #XXX
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
1282 |
[('Any SN WHERE NOT EXISTS(X in_state S, X is Note), S name SN, S is State', |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
1283 |
[{'S': 'State', 'SN': 'String', 'X': 'Note'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1284 |
None, None, [self.cards, self.system], {}, |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
1285 |
[]), |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
1286 |
('OneFetchStep', |
5582
3e133b29a1a4
[rql2sql] follow rql 0.26.1 changes: NOT nodes normalization, allowing simplification of sql generation, and fix #XXX
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
1287 |
[('Any SN WHERE NOT EXISTS(X in_state S, X is IN(Affaire, CWUser)), S name SN, S is State', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1288 |
[{'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
|
1289 |
{'S': 'State', 'SN': 'String', 'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1290 |
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
|
1291 |
[]),] |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1292 |
)]) |
1785 | 1293 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1294 |
def test_external_attributes_and_relation(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1295 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1296 |
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
|
1297 |
[('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
|
1298 |
[{'A': 'Note', 'C': 'Datetime', 'B': 'Datetime'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1299 |
[self.cards], None, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1300 |
{'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
|
1301 |
#('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
|
1302 |
# [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
|
1303 |
('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
|
1304 |
[{'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
|
1305 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1306 |
{'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
|
1307 |
{'x': 999999}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1308 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1309 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1310 |
def test_simplified_var(self): |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1311 |
ueid = self.session.user.eid |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1312 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1313 |
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', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1314 |
[('OneFetchStep', [('Any %s WHERE %s in_group G, (G name IN("managers", "logilab")) OR (X require_permission P?, P name "bla", P require_group G), X eid 999999' % (ueid, ueid), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1315 |
[{'X': 'Note', 'G': 'CWGroup', 'P': 'CWPermission'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1316 |
None, None, [self.system], {}, [])], |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1317 |
{'x': 999999, 'u': ueid}) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1318 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1319 |
def test_has_text(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1320 |
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
|
1321 |
[('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
|
1322 |
[{'X': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1323 |
None, None, [self.system], {}, [])]) |
1785 | 1324 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1325 |
def test_has_text_3(self): |
3587 | 1326 |
self._test('Any X WHERE X has_text "toto", X title "zoubidou", X is IN (Card, EmailThread)', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1327 |
[('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
|
1328 |
[{'X': 'Card'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1329 |
[self.cards, self.system], None, {'X': 'table0.C0'}, []), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1330 |
('UnionStep', None, None, [ |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1331 |
('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
|
1332 |
[{'X': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1333 |
None, None, [self.system], {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1334 |
('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
|
1335 |
[{'X': 'EmailThread'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1336 |
None, None, [self.system], {}, []), |
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 |
]) |
1785 | 1339 |
|
5768
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1340 |
def test_has_text_orderby_rank(self): |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1341 |
self._test('Any X ORDERBY FTIRANK(X) WHERE X has_text "bla", X firstname "bla"', |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1342 |
[('FetchStep', [('Any X WHERE X firstname "bla", X is CWUser', [{'X': 'CWUser'}])], |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1343 |
[self.ldap, self.system], None, {'X': 'table0.C0'}, []), |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1344 |
('AggrStep', 'SELECT table1.C1 FROM table1 ORDER BY table1.C0', None, [ |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1345 |
('FetchStep', [('Any FTIRANK(X),X WHERE X has_text "bla", X is CWUser', |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1346 |
[{'X': 'CWUser'}])], |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1347 |
[self.system], {'X': 'table0.C0'}, {'FTIRANK(X)': 'table1.C0', 'X': 'table1.C1'}, []), |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1348 |
('FetchStep', [('Any FTIRANK(X),X WHERE X has_text "bla", X firstname "bla", X is Personne', |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1349 |
[{'X': 'Personne'}])], |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1350 |
[self.system], {}, {'FTIRANK(X)': 'table1.C0', 'X': 'table1.C1'}, []), |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1351 |
]), |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1352 |
]) |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1353 |
|
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1354 |
def test_security_has_text_orderby_rank(self): |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1355 |
# use a guest user |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1356 |
self.session = self.user_groups_session('guests') |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1357 |
ueid = self.session.user.eid |
5768
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1358 |
self._test('Any X ORDERBY FTIRANK(X) WHERE X has_text "bla", X firstname "bla"', |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1359 |
[('FetchStep', [('Any X WHERE X firstname "bla", X is CWUser', [{'X': 'CWUser'}])], |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1360 |
[self.ldap, self.system], None, {'X': 'table1.C0'}, []), |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1361 |
('UnionFetchStep', |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1362 |
[('FetchStep', [('Any X WHERE X firstname "bla", X is Personne', [{'X': 'Personne'}])], |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1363 |
[self.system], {}, {'X': 'table0.C0'}, []), |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1364 |
('FetchStep', [('Any X WHERE EXISTS(X owned_by %s), X is CWUser' % ueid, [{'X': 'CWUser'}])], |
5768
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1365 |
[self.system], {'X': 'table1.C0'}, {'X': 'table0.C0'}, [])]), |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1366 |
('OneFetchStep', [('Any X ORDERBY FTIRANK(X) WHERE X has_text "bla"', |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1367 |
[{'X': 'CWUser'}, {'X': 'Personne'}])], |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1368 |
None, None, [self.system], {'X': 'table0.C0'}, []), |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1369 |
]) |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1370 |
|
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1371 |
def test_has_text_select_rank(self): |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1372 |
self._test('Any X, FTIRANK(X) WHERE X has_text "bla", X firstname "bla"', |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1373 |
# XXX unecessary duplicate selection |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1374 |
[('FetchStep', [('Any X,X WHERE X firstname "bla", X is CWUser', [{'X': 'CWUser'}])], |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1375 |
[self.ldap, self.system], None, {'X': 'table0.C1'}, []), |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1376 |
('UnionStep', None, None, [ |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1377 |
('OneFetchStep', [('Any X,FTIRANK(X) WHERE X has_text "bla", X is CWUser', [{'X': 'CWUser'}])], |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1378 |
None, None, [self.system], {'X': 'table0.C1'}, []), |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1379 |
('OneFetchStep', [('Any X,FTIRANK(X) WHERE X has_text "bla", X firstname "bla", X is Personne', [{'X': 'Personne'}])], |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1380 |
None, None, [self.system], {}, []), |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1381 |
]), |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1382 |
]) |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1383 |
|
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1384 |
def test_security_has_text_select_rank(self): |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1385 |
# use a guest user |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1386 |
self.session = self.user_groups_session('guests') |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1387 |
ueid = self.session.user.eid |
5768
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1388 |
self._test('Any X, FTIRANK(X) WHERE X has_text "bla", X firstname "bla"', |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1389 |
[('FetchStep', [('Any X,X WHERE X firstname "bla", X is CWUser', [{'X': 'CWUser'}])], |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1390 |
[self.ldap, self.system], None, {'X': 'table0.C1'}, []), |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1391 |
('UnionStep', None, None, [ |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1392 |
('OneFetchStep', [('Any X,FTIRANK(X) WHERE X has_text "bla", EXISTS(X owned_by %s), X is CWUser' % ueid, [{'X': 'CWUser'}])], |
5768
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1393 |
None, None, [self.system], {'X': 'table0.C1'}, []), |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1394 |
('OneFetchStep', [('Any X,FTIRANK(X) WHERE X has_text "bla", X firstname "bla", X is Personne', [{'X': 'Personne'}])], |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1395 |
None, None, [self.system], {}, []), |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1396 |
]), |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1397 |
]) |
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1398 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1399 |
def test_sort_func(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1400 |
self._test('Note X ORDERBY DUMB_SORT(RF) WHERE X type RF', |
5768
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1401 |
[('AggrStep', 'SELECT table0.C0 FROM table0 ORDER BY DUMB_SORT(table0.C1)', None, [ |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1402 |
('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
|
1403 |
[{'X': 'Note', 'RF': 'String'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1404 |
[self.cards, self.system], {}, {'X': 'table0.C0', 'X.type': 'table0.C1', 'RF': 'table0.C1'}, []), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1405 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1406 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1407 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1408 |
def test_ambigous_sort_func(self): |
3587 | 1409 |
self._test('Any X ORDERBY DUMB_SORT(RF) WHERE X title RF, X is IN (Bookmark, Card, EmailThread)', |
5768
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
1410 |
[('AggrStep', 'SELECT table0.C0 FROM table0 ORDER BY DUMB_SORT(table0.C1)', None, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1411 |
[('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
|
1412 |
[{'X': 'Card', 'RF': 'String'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1413 |
[self.cards, self.system], {}, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1414 |
{'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
|
1415 |
('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
|
1416 |
[{'RF': 'String', 'X': 'Bookmark'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1417 |
{'RF': 'String', 'X': 'EmailThread'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1418 |
[self.system], {}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1419 |
{'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
|
1420 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1421 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1422 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1423 |
def test_attr_unification_1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1424 |
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
|
1425 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1426 |
[('Any Y,T WHERE Y title T, Y is Card', [{'T': 'String', 'Y': 'Card'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1427 |
[self.cards, self.system], None, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1428 |
{'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
|
1429 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1430 |
[('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
|
1431 |
[{'T': 'String', 'X': 'Bookmark', 'Y': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1432 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1433 |
{'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
|
1434 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1435 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1436 |
def test_attr_unification_2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1437 |
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
|
1438 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1439 |
[('Any X,T WHERE X type T, X is Note', [{'T': 'String', 'X': 'Note'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1440 |
[self.cards, self.system], None, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1441 |
{'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
|
1442 |
('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1443 |
[('Any Y,T WHERE Y title T, Y is Card', [{'T': 'String', 'Y': 'Card'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1444 |
[self.cards, self.system], None, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1445 |
{'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
|
1446 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1447 |
[('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
|
1448 |
[{'T': 'String', 'X': 'Note', 'Y': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1449 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1450 |
{'T': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1451 |
'X': 'table0.C0', 'X.type': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1452 |
'Y': 'table1.C0', 'Y.title': 'table1.C1'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1453 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1454 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1455 |
def test_attr_unification_neq_1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1456 |
self._test('Any X,Y WHERE X is Bookmark, Y is Card, X creation_date D, Y creation_date > D', |
1785 | 1457 |
[('FetchStep', |
3815
50b87f759b5d
test and fix http://www.logilab.org/ticket/499838
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3689
diff
changeset
|
1458 |
[('Any Y,D WHERE Y creation_date D, Y is Card', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1459 |
[{'D': 'Datetime', 'Y': 'Card'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1460 |
[self.cards,self.system], None, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1461 |
{'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
|
1462 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1463 |
[('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
|
1464 |
[{'D': 'Datetime', 'X': 'Bookmark', 'Y': 'Card'}])], None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1465 |
[self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1466 |
{'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
|
1467 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1468 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1469 |
def test_subquery_1(self): |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1470 |
ueid = self.session.user.eid |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1471 |
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
|
1472 |
'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
|
1473 |
[('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
|
1474 |
('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
|
1475 |
[{'T': 'String', 'X': 'Bookmark'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1476 |
[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
|
1477 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1478 |
[('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
|
1479 |
[self.ldap, self.system], None, {'B': 'table1.C0', 'B.login': 'table1.C1', 'C': 'table1.C1'}, []), |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1480 |
('OneFetchStep', [('DISTINCT Any B,C ORDERBY C WHERE A created_by B, B login C, EXISTS(B owned_by %s), B is CWUser, A is IN(Bookmark, Tag)' % ueid, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1481 |
[{'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
|
1482 |
{'A': 'Tag', 'B': 'CWUser', 'C': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1483 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1484 |
{'A': 'table0.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1485 |
'B': 'table1.C0', 'B.login': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1486 |
'C': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1487 |
'N': 'table0.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1488 |
[])], |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1489 |
{'E': ueid}) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1490 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1491 |
def test_subquery_2(self): |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1492 |
ueid = self.session.user.eid |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1493 |
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
|
1494 |
'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
|
1495 |
[('UnionFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1496 |
[('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
|
1497 |
[self.system], {}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1498 |
{'N': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1499 |
'T': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1500 |
'X': 'table0.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1501 |
'X.name': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1502 |
'X.title': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1503 |
('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
|
1504 |
[{'T': 'String', 'X': 'Card'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1505 |
[self.cards, self.system], {}, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1506 |
{'N': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1507 |
'T': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1508 |
'X': 'table0.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1509 |
'X.name': 'table0.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1510 |
'X.title': 'table0.C1'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1511 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1512 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1513 |
[('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
|
1514 |
[self.ldap, self.system], None, {'B': 'table1.C0', 'B.login': 'table1.C1', 'C': 'table1.C1'}, []), |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1515 |
('OneFetchStep', [('DISTINCT Any B,C ORDERBY C WHERE A created_by B, B login C, EXISTS(B owned_by %s), B is CWUser, A is IN(Card, Tag)' % ueid, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1516 |
[{'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
|
1517 |
{'A': 'Tag', 'B': 'CWUser', 'C': 'String'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1518 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1519 |
{'A': 'table0.C0', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1520 |
'B': 'table1.C0', 'B.login': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1521 |
'C': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1522 |
'N': 'table0.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1523 |
[])], |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1524 |
{'E': ueid}) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1525 |
|
5420
09b50d7e5321
[ms] fix planning bug with rewritten constants: when removing some source for a const due to relation constraints, we should propagate this change to other constants coming from the same original variable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4915
diff
changeset
|
1526 |
def test_eid_dont_cross_relation_1(self): |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1527 |
repo._type_source_cache[999999] = ('Personne', 'system', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1528 |
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
|
1529 |
[('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
|
1530 |
[{'X': 'Personne', 'Y': 'Card', 'YT': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1531 |
None, None, [self.system], {}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1532 |
{'x': 999999}) |
393 | 1533 |
|
5420
09b50d7e5321
[ms] fix planning bug with rewritten constants: when removing some source for a const due to relation constraints, we should propagate this change to other constants coming from the same original variable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4915
diff
changeset
|
1534 |
def test_eid_dont_cross_relation_2(self): |
09b50d7e5321
[ms] fix planning bug with rewritten constants: when removing some source for a const due to relation constraints, we should propagate this change to other constants coming from the same original variable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4915
diff
changeset
|
1535 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
09b50d7e5321
[ms] fix planning bug with rewritten constants: when removing some source for a const due to relation constraints, we should propagate this change to other constants coming from the same original variable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4915
diff
changeset
|
1536 |
self.cards.dont_cross_relations.add('concerne') |
09b50d7e5321
[ms] fix planning bug with rewritten constants: when removing some source for a const due to relation constraints, we should propagate this change to other constants coming from the same original variable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4915
diff
changeset
|
1537 |
try: |
09b50d7e5321
[ms] fix planning bug with rewritten constants: when removing some source for a const due to relation constraints, we should propagate this change to other constants coming from the same original variable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4915
diff
changeset
|
1538 |
self._test('Any Y,S,YT,X WHERE Y concerne X, Y in_state S, X eid 999999, Y ref YT', |
09b50d7e5321
[ms] fix planning bug with rewritten constants: when removing some source for a const due to relation constraints, we should propagate this change to other constants coming from the same original variable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4915
diff
changeset
|
1539 |
[('OneFetchStep', [('Any Y,S,YT,999999 WHERE Y concerne 999999, Y in_state S, Y ref YT', |
09b50d7e5321
[ms] fix planning bug with rewritten constants: when removing some source for a const due to relation constraints, we should propagate this change to other constants coming from the same original variable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4915
diff
changeset
|
1540 |
[{'Y': 'Affaire', 'YT': 'String', 'S': 'State'}])], |
09b50d7e5321
[ms] fix planning bug with rewritten constants: when removing some source for a const due to relation constraints, we should propagate this change to other constants coming from the same original variable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4915
diff
changeset
|
1541 |
None, None, [self.system], {}, [])], |
09b50d7e5321
[ms] fix planning bug with rewritten constants: when removing some source for a const due to relation constraints, we should propagate this change to other constants coming from the same original variable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4915
diff
changeset
|
1542 |
{'x': 999999}) |
09b50d7e5321
[ms] fix planning bug with rewritten constants: when removing some source for a const due to relation constraints, we should propagate this change to other constants coming from the same original variable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4915
diff
changeset
|
1543 |
finally: |
09b50d7e5321
[ms] fix planning bug with rewritten constants: when removing some source for a const due to relation constraints, we should propagate this change to other constants coming from the same original variable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4915
diff
changeset
|
1544 |
self.cards.dont_cross_relations.remove('concerne') |
09b50d7e5321
[ms] fix planning bug with rewritten constants: when removing some source for a const due to relation constraints, we should propagate this change to other constants coming from the same original variable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4915
diff
changeset
|
1545 |
|
393 | 1546 |
|
1547 |
# external source w/ .cross_relations == ['multisource_crossed_rel'] ###### |
|
1785 | 1548 |
|
393 | 1549 |
def test_crossed_relation_eid_1_invariant(self): |
1550 |
repo._type_source_cache[999999] = ('Note', 'system', 999999) |
|
1551 |
self._test('Any Y WHERE X eid %(x)s, X multisource_crossed_rel Y', |
|
1552 |
[('OneFetchStep', [('Any Y WHERE 999999 multisource_crossed_rel Y', [{u'Y': 'Note'}])], |
|
1553 |
None, None, [self.system], {}, []) |
|
1554 |
], |
|
1555 |
{'x': 999999,}) |
|
1556 |
||
1557 |
def test_crossed_relation_eid_1_needattr(self): |
|
1558 |
repo._type_source_cache[999999] = ('Note', 'system', 999999) |
|
1559 |
self._test('Any Y,T WHERE X eid %(x)s, X multisource_crossed_rel Y, Y type T', |
|
1560 |
[('FetchStep', [('Any Y,T WHERE Y type T, Y is Note', [{'T': 'String', 'Y': 'Note'}])], |
|
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1561 |
[self.cards, self.system], None, |
393 | 1562 |
{'T': 'table0.C1', 'Y': 'table0.C0', 'Y.type': 'table0.C1'}, []), |
1563 |
('OneFetchStep', [('Any Y,T WHERE 999999 multisource_crossed_rel Y, Y type T, Y is Note', |
|
1564 |
[{'T': 'String', 'Y': 'Note'}])], |
|
1565 |
None, None, [self.system], |
|
1566 |
{'T': 'table0.C1', 'Y': 'table0.C0', 'Y.type': 'table0.C1'}, []), |
|
1567 |
], |
|
1568 |
{'x': 999999,}) |
|
1569 |
||
1570 |
def test_crossed_relation_eid_2_invariant(self): |
|
1571 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
|
1572 |
self._test('Any Y WHERE X eid %(x)s, X multisource_crossed_rel Y', |
|
1573 |
[('OneFetchStep', [('Any Y WHERE 999999 multisource_crossed_rel Y, Y is Note', [{'Y': 'Note'}])], |
|
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1574 |
None, None, [self.cards, self.system], {}, []) |
393 | 1575 |
], |
1576 |
{'x': 999999,}) |
|
1577 |
||
1231
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
1578 |
def test_crossed_relation_eid_2_needattr(self): |
393 | 1579 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
1785 | 1580 |
self._test('Any Y,T WHERE X eid %(x)s, X multisource_crossed_rel Y, Y type T', |
6131
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
1581 |
[('OneFetchStep', [('Any Y,T WHERE 999999 multisource_crossed_rel Y, Y type T, Y is Note', |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
1582 |
[{'T': 'String', 'Y': 'Note'}])], |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
1583 |
None, None, [self.cards, self.system], {}, |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
1584 |
[]), |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
1585 |
], |
393 | 1586 |
{'x': 999999,}) |
1587 |
||
1588 |
def test_crossed_relation_eid_not_1(self): |
|
1589 |
repo._type_source_cache[999999] = ('Note', 'system', 999999) |
|
1590 |
self._test('Any Y WHERE X eid %(x)s, NOT X multisource_crossed_rel Y', |
|
1591 |
[('FetchStep', [('Any Y WHERE Y is Note', [{'Y': 'Note'}])], |
|
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1592 |
[self.cards, self.system], None, {'Y': 'table0.C0'}, []), |
5582
3e133b29a1a4
[rql2sql] follow rql 0.26.1 changes: NOT nodes normalization, allowing simplification of sql generation, and fix #XXX
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
1593 |
('OneFetchStep', [('Any Y WHERE NOT EXISTS(999999 multisource_crossed_rel Y), Y is Note', |
393 | 1594 |
[{'Y': 'Note'}])], |
1595 |
None, None, [self.system], |
|
1596 |
{'Y': 'table0.C0'}, [])], |
|
1597 |
{'x': 999999,}) |
|
1598 |
||
1599 |
# def test_crossed_relation_eid_not_2(self): |
|
1600 |
# repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
|
1601 |
# self._test('Any Y WHERE X eid %(x)s, NOT X multisource_crossed_rel Y', |
|
1602 |
# [], |
|
1603 |
# {'x': 999999,}) |
|
1604 |
||
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
1605 |
def test_crossed_relation_base_XXXFIXME(self): |
393 | 1606 |
repo._type_source_cache[999999] = ('Note', 'system', 999999) |
1607 |
self._test('Any X,Y,T WHERE X multisource_crossed_rel Y, Y type T, X type T', |
|
1608 |
[('FetchStep', [('Any X,T WHERE X type T, X is Note', [{'T': 'String', 'X': 'Note'}])], |
|
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1609 |
[self.cards, self.system], None, |
393 | 1610 |
{'T': 'table0.C1', 'X': 'table0.C0', 'X.type': 'table0.C1'}, []), |
1611 |
('FetchStep', [('Any Y,T WHERE Y type T, Y is Note', [{'T': 'String', 'Y': 'Note'}])], |
|
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1612 |
[self.cards, self.system], None, |
393 | 1613 |
{'T': 'table1.C1', 'Y': 'table1.C0', 'Y.type': 'table1.C1'}, []), |
6758
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1614 |
('FetchStep', [('Any X,Y WHERE X multisource_crossed_rel Y, X is Note, Y is Note', |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1615 |
[{'X': 'Note', 'Y': 'Note'}])], |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1616 |
[self.cards, self.system], None, |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1617 |
{'X': 'table2.C0', 'Y': 'table2.C1'}, |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1618 |
[]), |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1619 |
('OneFetchStep', [('Any X,Y,T WHERE X multisource_crossed_rel Y, Y type T, X type T, ' |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1620 |
'X is Note, Y is Note, Y identity A, X identity B, A is Note, B is Note', |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1621 |
[{u'A': 'Note', u'B': 'Note', 'T': 'String', 'X': 'Note', 'Y': 'Note'}])], |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1622 |
None, None, |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1623 |
[self.system], |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1624 |
{'A': 'table1.C0', |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1625 |
'B': 'table0.C0', |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1626 |
'T': 'table1.C1', |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1627 |
'X': 'table2.C0', |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1628 |
'X.type': 'table0.C1', |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1629 |
'Y': 'table2.C1', |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1630 |
'Y.type': 'table1.C1'}, |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1631 |
[]), |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1632 |
], |
393 | 1633 |
{'x': 999999,}) |
1785 | 1634 |
|
6758
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1635 |
def test_crossed_relation_noeid_needattr(self): |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1636 |
# http://www.cubicweb.org/ticket/1382452 |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1637 |
self._test('DISTINCT Any DEP WHERE DEP is Note, P type "cubicweb-foo", P multisource_crossed_rel DEP, DEP type LIKE "cubicweb%"', |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1638 |
[('FetchStep', [(u'Any DEP WHERE DEP type LIKE "cubicweb%", DEP is Note', |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1639 |
[{'DEP': 'Note'}])], |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1640 |
[self.cards, self.system], None, |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1641 |
{'DEP': 'table0.C0'}, |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1642 |
[]), |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1643 |
('FetchStep', [(u'Any P WHERE P type "cubicweb-foo", P is Note', [{'P': 'Note'}])], |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1644 |
[self.cards, self.system], None, {'P': 'table1.C0'}, |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1645 |
[]), |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1646 |
('FetchStep', [('Any DEP,P WHERE P multisource_crossed_rel DEP, DEP is Note, P is Note', |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1647 |
[{'DEP': 'Note', 'P': 'Note'}])], |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1648 |
[self.cards, self.system], None, {'DEP': 'table2.C0', 'P': 'table2.C1'}, |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1649 |
[]), |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1650 |
('OneFetchStep', |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1651 |
[('DISTINCT Any DEP WHERE P multisource_crossed_rel DEP, DEP is Note, ' |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1652 |
'P is Note, DEP identity A, P identity B, A is Note, B is Note', |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1653 |
[{u'A': 'Note', u'B': 'Note', 'DEP': 'Note', 'P': 'Note'}])], |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1654 |
None, None, [self.system], |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1655 |
{'A': 'table0.C0', 'B': 'table1.C0', 'DEP': 'table2.C0', 'P': 'table2.C1'}, |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1656 |
[])]) |
28b11ecf319b
[ms] #1382452: incorrect results with multi-sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6676
diff
changeset
|
1657 |
|
6759
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1658 |
def test_crossed_relation_noeid_invariant(self): |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1659 |
# see comment in http://www.cubicweb.org/ticket/1382452 |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1660 |
self.schema.add_relation_def( |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1661 |
RelationDefinition(subject='Note', name='multisource_crossed_rel', object='Affaire')) |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1662 |
self.repo.set_schema(self.schema) |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1663 |
try: |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1664 |
self._test('DISTINCT Any P,DEP WHERE P type "cubicweb-foo", P multisource_crossed_rel DEP', |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1665 |
[('FetchStep', |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1666 |
[('Any DEP WHERE DEP is Note', [{'DEP': 'Note'}])], |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1667 |
[self.cards, self.system], None, {'DEP': 'table0.C0'}, []), |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1668 |
('FetchStep', |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1669 |
[(u'Any P WHERE P type "cubicweb-foo", P is Note', [{'P': 'Note'}])], |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1670 |
[self.cards, self.system], None, {'P': 'table1.C0'}, []), |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1671 |
('UnionStep', None, None, |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1672 |
[('OneFetchStep', |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1673 |
[('DISTINCT Any P,DEP WHERE P multisource_crossed_rel DEP, DEP is Note, P is Note', |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1674 |
[{'DEP': 'Note', 'P': 'Note'}])], |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1675 |
None, None, [self.cards], None, []), |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1676 |
('OneFetchStep', |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1677 |
[('DISTINCT Any P,DEP WHERE P multisource_crossed_rel DEP, DEP is Note, P is Note', |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1678 |
[{'DEP': 'Note', 'P': 'Note'}])], |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1679 |
None, None, [self.system], |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1680 |
{'DEP': 'table0.C0', 'P': 'table1.C0'}, |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1681 |
[]), |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1682 |
('OneFetchStep', |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1683 |
[('DISTINCT Any P,DEP WHERE P multisource_crossed_rel DEP, DEP is Affaire, P is Note', |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1684 |
[{'DEP': 'Affaire', 'P': 'Note'}])], |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1685 |
None, None, [self.system], {'P': 'table1.C0'}, |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1686 |
[])]) |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1687 |
]) |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1688 |
finally: |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1689 |
self.schema.del_relation_def('Note', 'multisource_crossed_rel', 'Affaire') |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1690 |
self.repo.set_schema(self.schema) |
5d016d5bacca
[ms] fix ms planner crash on some ambiguous queries, as demonstrated in a comment on http://www.cubicweb.org/ticket/1382452
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6758
diff
changeset
|
1691 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1692 |
# edition queries tests ################################################### |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1693 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1694 |
def test_insert_simplified_var_1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1695 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1696 |
repo._type_source_cache[999998] = ('State', 'system', None) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1697 |
self._test('INSERT Note X: X in_state S, X type T WHERE S eid %(s)s, N eid %(n)s, N type T', |
4764
ec9c20c6b9f7
[repo] improve planning of insert/update queries: do not select affected constants so the don't go and back to/from the source.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
1698 |
[('InsertStep', |
ec9c20c6b9f7
[repo] improve planning of insert/update queries: do not select affected constants so the don't go and back to/from the source.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
1699 |
[('InsertRelationsStep', |
ec9c20c6b9f7
[repo] improve planning of insert/update queries: do not select affected constants so the don't go and back to/from the source.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
1700 |
[('OneFetchStep', [('Any T WHERE N eid 999999, N type T, N is Note', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1701 |
[{'N': 'Note', 'T': 'String'}])], |
4764
ec9c20c6b9f7
[repo] improve planning of insert/update queries: do not select affected constants so the don't go and back to/from the source.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
1702 |
None, None, [self.cards], {}, [])]) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1703 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1704 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1705 |
{'n': 999999, 's': 999998}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1706 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1707 |
def test_insert_simplified_var_2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1708 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1709 |
repo._type_source_cache[999998] = ('State', 'system', None) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1710 |
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', |
4764
ec9c20c6b9f7
[repo] improve planning of insert/update queries: do not select affected constants so the don't go and back to/from the source.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
1711 |
[('InsertStep', |
ec9c20c6b9f7
[repo] improve planning of insert/update queries: do not select affected constants so the don't go and back to/from the source.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
1712 |
[('InsertRelationsStep', |
ec9c20c6b9f7
[repo] improve planning of insert/update queries: do not select affected constants so the don't go and back to/from the source.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
1713 |
[('OneFetchStep', [('Any T WHERE N eid 999999, N type T, N is Note', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1714 |
[{'N': 'Note', 'T': 'String'}])], |
4764
ec9c20c6b9f7
[repo] improve planning of insert/update queries: do not select affected constants so the don't go and back to/from the source.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
1715 |
None, None, [self.cards], {}, []) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1716 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1717 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1718 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1719 |
{'n': 999999, 's': 999998}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1720 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1721 |
def test_insert_simplified_var_3(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1722 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1723 |
repo._type_source_cache[999998] = ('State', 'cards', 999998) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1724 |
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
|
1725 |
[('InsertStep', |
4764
ec9c20c6b9f7
[repo] improve planning of insert/update queries: do not select affected constants so the don't go and back to/from the source.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
1726 |
[('InsertRelationsStep', |
ec9c20c6b9f7
[repo] improve planning of insert/update queries: do not select affected constants so the don't go and back to/from the source.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
1727 |
[('OneFetchStep', [('Any T WHERE N eid 999999, N type T, N is Note', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1728 |
[{'N': 'Note', 'T': 'String'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1729 |
None, None, [self.cards], {}, [])] |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1730 |
)] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1731 |
)], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1732 |
{'n': 999999, 's': 999998}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1733 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1734 |
def test_insert_simplified_var_4(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1735 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1736 |
repo._type_source_cache[999998] = ('State', 'system', None) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1737 |
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
|
1738 |
[('InsertStep', |
4764
ec9c20c6b9f7
[repo] improve planning of insert/update queries: do not select affected constants so the don't go and back to/from the source.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
1739 |
[('InsertRelationsStep', [])] |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1740 |
)], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1741 |
{'n': 999999, 's': 999998}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1742 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1743 |
def test_insert_simplified_var_5(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1744 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1745 |
repo._type_source_cache[999998] = ('State', 'system', None) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1746 |
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
|
1747 |
[('InsertStep', |
4817
9c8b39914998
fix bad test fix
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4775
diff
changeset
|
1748 |
[('InsertRelationsStep', |
9c8b39914998
fix bad test fix
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4775
diff
changeset
|
1749 |
[('OneFetchStep', |
9c8b39914998
fix bad test fix
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4775
diff
changeset
|
1750 |
[('Any A WHERE A concerne 999999, A is Affaire', |
9c8b39914998
fix bad test fix
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4775
diff
changeset
|
1751 |
[{'A': 'Affaire'}])], |
9c8b39914998
fix bad test fix
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4775
diff
changeset
|
1752 |
None, None, [self.system], {}, []), |
9c8b39914998
fix bad test fix
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4775
diff
changeset
|
1753 |
]), |
9c8b39914998
fix bad test fix
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4775
diff
changeset
|
1754 |
]) |
9c8b39914998
fix bad test fix
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4775
diff
changeset
|
1755 |
], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1756 |
{'n': 999999, 's': 999998}) |
1785 | 1757 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1758 |
def test_delete_relation1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1759 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1760 |
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
|
1761 |
[('DeleteRelationsStep', [ |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1762 |
('OneFetchStep', [('Any %s,Y WHERE %s created_by Y, NOT Y eid %s, Y is CWUser' % (ueid, ueid, ueid), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1763 |
[{'Y': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1764 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1765 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1766 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1767 |
{'x': ueid, 'y': ueid}) |
1785 | 1768 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1769 |
def test_delete_relation2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1770 |
ueid = self.session.user.eid |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1771 |
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
|
1772 |
[('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
|
1773 |
[self.ldap, self.system], None, {'Y': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1774 |
('DeleteRelationsStep', [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1775 |
('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
|
1776 |
None, None, [self.system], {'Y': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1777 |
]), |
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 |
{'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
|
1780 |
|
6673
5eb2f1f2c277
[ms planning] test and fix bad plannification of a query used on cascading delete of a deleted (external) entity relations
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6654
diff
changeset
|
1781 |
def test_delete_relation3(self): |
5eb2f1f2c277
[ms planning] test and fix bad plannification of a query used on cascading delete of a deleted (external) entity relations
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6654
diff
changeset
|
1782 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
5eb2f1f2c277
[ms planning] test and fix bad plannification of a query used on cascading delete of a deleted (external) entity relations
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6654
diff
changeset
|
1783 |
self._test('DELETE Y multisource_inlined_rel X WHERE X eid %(x)s, NOT (Y cw_source S, S name %(source)s)', |
5eb2f1f2c277
[ms planning] test and fix bad plannification of a query used on cascading delete of a deleted (external) entity relations
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6654
diff
changeset
|
1784 |
[('DeleteRelationsStep', |
5eb2f1f2c277
[ms planning] test and fix bad plannification of a query used on cascading delete of a deleted (external) entity relations
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6654
diff
changeset
|
1785 |
[('OneFetchStep', |
5eb2f1f2c277
[ms planning] test and fix bad plannification of a query used on cascading delete of a deleted (external) entity relations
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6654
diff
changeset
|
1786 |
[('Any Y,999999 WHERE Y multisource_inlined_rel 999999, NOT EXISTS(Y cw_source S, S name "cards"), S is CWSource, Y is IN(Card, Note)', |
5eb2f1f2c277
[ms planning] test and fix bad plannification of a query used on cascading delete of a deleted (external) entity relations
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6654
diff
changeset
|
1787 |
[{'S': 'CWSource', 'Y': 'Card'}, {'S': 'CWSource', 'Y': 'Note'}])], |
5eb2f1f2c277
[ms planning] test and fix bad plannification of a query used on cascading delete of a deleted (external) entity relations
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6654
diff
changeset
|
1788 |
None, None, [self.system], {}, |
5eb2f1f2c277
[ms planning] test and fix bad plannification of a query used on cascading delete of a deleted (external) entity relations
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6654
diff
changeset
|
1789 |
[])] |
5eb2f1f2c277
[ms planning] test and fix bad plannification of a query used on cascading delete of a deleted (external) entity relations
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6654
diff
changeset
|
1790 |
)], |
5eb2f1f2c277
[ms planning] test and fix bad plannification of a query used on cascading delete of a deleted (external) entity relations
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6654
diff
changeset
|
1791 |
{'x': 999999, 'source': 'cards'}) |
5eb2f1f2c277
[ms planning] test and fix bad plannification of a query used on cascading delete of a deleted (external) entity relations
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6654
diff
changeset
|
1792 |
|
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
|
1793 |
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
|
1794 |
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
|
1795 |
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
|
1796 |
[('DeleteEntitiesStep', |
5582
3e133b29a1a4
[rql2sql] follow rql 0.26.1 changes: NOT nodes normalization, allowing simplification of sql generation, and fix #XXX
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
1797 |
[('OneFetchStep', [('Any 999999 WHERE NOT EXISTS(Y multisource_rel 999999), Y is IN(Card, Note)', |
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
|
1798 |
[{'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
|
1799 |
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
|
1800 |
]) |
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
|
1801 |
], |
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
|
1802 |
{'x': 999999}) |
1785 | 1803 |
|
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
|
1804 |
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
|
1805 |
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
|
1806 |
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
|
1807 |
[('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
|
1808 |
[('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
|
1809 |
[{'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
|
1810 |
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
|
1811 |
]) |
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
|
1812 |
], |
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
|
1813 |
{'x': 999999}) |
1785 | 1814 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1815 |
def test_update(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1816 |
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
|
1817 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1818 |
[('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
|
1819 |
[self.ldap, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1820 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1821 |
[('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
|
1822 |
[self.ldap, self.system], None, {'Y': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1823 |
('UpdateStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1824 |
[('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1825 |
[('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
|
1826 |
[{'X': 'CWUser', 'Y': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1827 |
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
|
1828 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1829 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1830 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1831 |
def test_update2(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1832 |
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
|
1833 |
[('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
|
1834 |
[self.ldap, self.system], None, {'U': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1835 |
('UpdateStep', [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1836 |
('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
|
1837 |
[{'U': 'CWUser', 'G': 'CWGroup'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1838 |
None, None, [self.system], {'U': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1839 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1840 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1841 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1842 |
def test_update3(self): |
4674
3d509dbb473a
[test api] rename _user_session to user_groups_session, fix its arguments and return only the session, not (user, session) to make things clearer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
1843 |
anoneid = self.user_groups_session('guests').user.eid |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1844 |
# 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
|
1845 |
# 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
|
1846 |
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
|
1847 |
[('UpdateStep', [ |
4764
ec9c20c6b9f7
[repo] improve planning of insert/update queries: do not select affected constants so the don't go and back to/from the source.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
1848 |
('OneFetchStep', [('DISTINCT Any S WHERE S name "deactivated", S is State', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1849 |
[{'S': 'State'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1850 |
None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1851 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1852 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1853 |
{'x': anoneid}) |
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 |
# def test_update4(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1856 |
# # 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
|
1857 |
# # 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
|
1858 |
# 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
|
1859 |
# assert len(rset) == 1, rset |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1860 |
# 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
|
1861 |
# 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
|
1862 |
# [('UpdateStep', [ |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
1863 |
# ('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
|
1864 |
# [{'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1865 |
# None, None, [self.system], {}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1866 |
# ]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1867 |
# ]) |
1785 | 1868 |
|
6129
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1869 |
def test_ldap_user_related_to_invariant_and_dont_cross_rel(self): |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1870 |
self.repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1871 |
self.cards.dont_cross_relations.add('created_by') |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1872 |
try: |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1873 |
self._test('Any X,XL WHERE E eid %(x)s, E created_by X, X login XL', |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1874 |
[('FetchStep', [('Any X,XL WHERE X login XL, X is CWUser', |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1875 |
[{'X': 'CWUser', 'XL': 'String'}])], |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1876 |
[self.ldap, self.system], None, |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1877 |
{'X': 'table0.C0', 'X.login': 'table0.C1', 'XL': 'table0.C1'}, |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1878 |
[]), |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1879 |
('OneFetchStep', |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1880 |
[('Any X,XL WHERE 999999 created_by X, X login XL, X is CWUser', |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1881 |
[{'X': 'CWUser', 'XL': 'String'}])], |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1882 |
None, None, |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1883 |
[self.system], |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1884 |
{'X': 'table0.C0', 'X.login': 'table0.C1', 'XL': 'table0.C1'}, |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1885 |
[])], |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1886 |
{'x': 999999}) |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1887 |
finally: |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1888 |
self.cards.dont_cross_relations.remove('created_by') |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1889 |
|
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1890 |
def test_ambigous_cross_relation(self): |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1891 |
self.repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1892 |
self.cards.support_relations['see_also'] = True |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1893 |
self.cards.cross_relations.add('see_also') |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1894 |
try: |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1895 |
self._test('Any X,AA ORDERBY AA WHERE E eid %(x)s, E see_also X, X modification_date AA', |
6131
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
1896 |
[('AggrStep', |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
1897 |
'SELECT table0.C0, table0.C1 FROM table0 ORDER BY table0.C1', |
6129
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1898 |
None, |
6131
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
1899 |
[('FetchStep', |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
1900 |
[('Any X,AA WHERE 999999 see_also X, X modification_date AA, X is Note', |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
1901 |
[{'AA': 'Datetime', 'X': 'Note'}])], [self.cards, self.system], {}, |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
1902 |
{'AA': 'table0.C1', 'X': 'table0.C0', |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
1903 |
'X.modification_date': 'table0.C1'}, |
6129
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1904 |
[]), |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1905 |
('FetchStep', |
6131
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
1906 |
[('Any X,AA WHERE 999999 see_also X, X modification_date AA, X is Bookmark', |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
1907 |
[{'AA': 'Datetime', 'X': 'Bookmark'}])], |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
1908 |
[self.system], {}, |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
1909 |
{'AA': 'table0.C1', 'X': 'table0.C0', |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
1910 |
'X.modification_date': 'table0.C1'}, |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
1911 |
[])])], |
6129
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1912 |
{'x': 999999}) |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1913 |
finally: |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1914 |
del self.cards.support_relations['see_also'] |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1915 |
self.cards.cross_relations.remove('see_also') |
fea746b60093
[ms] fix two planner bugs: one occuring query such as X created_by U where X in a external source and U may come from an ldap source. The other being that when we've to merge input maps, we were modifying the same tree/solutions while a copy were needed. Also, ensure we add type restrictions, necessary for pyro source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6057
diff
changeset
|
1916 |
|
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1917 |
def test_state_of_cross(self): |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1918 |
self._test('DELETE State X WHERE NOT X state_of Y', |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1919 |
[('DeleteEntitiesStep', |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1920 |
[('OneFetchStep', |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1921 |
[('Any X WHERE NOT X state_of Y, X is State, Y is Workflow', |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1922 |
[{'X': 'State', 'Y': 'Workflow'}])], |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1923 |
None, None, [self.system], {}, [])])] |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1924 |
) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1925 |
|
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1926 |
|
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1927 |
def test_source_specified_0_0(self): |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1928 |
self._test('Card X WHERE X cw_source S, S eid 1', |
6633
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
1929 |
[('OneFetchStep', [('Any X WHERE X cw_source 1, X is Card', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1930 |
[{'X': 'Card'}])], |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1931 |
None, None, |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1932 |
[self.system],{}, []) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1933 |
]) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1934 |
|
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1935 |
def test_source_specified_0_1(self): |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1936 |
self._test('Any X, S WHERE X is Card, X cw_source S, S eid 1', |
6633
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
1937 |
[('OneFetchStep', [('Any X,1 WHERE X is Card, X cw_source 1', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1938 |
[{'X': 'Card'}])], |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1939 |
None, None, |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1940 |
[self.system],{}, []) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1941 |
]) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1942 |
|
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1943 |
def test_source_specified_1_0(self): |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1944 |
self._test('Card X WHERE X cw_source S, S name "system"', |
6633
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
1945 |
[('OneFetchStep', [('Any X WHERE X cw_source S, S name "system", X is Card', |
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
1946 |
[{'X': 'Card', 'S': 'CWSource'}])], |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1947 |
None, None, |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1948 |
[self.system],{}, []) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1949 |
]) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1950 |
|
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1951 |
def test_source_specified_1_1(self): |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1952 |
self._test('Any X, SN WHERE X is Card, X cw_source S, S name "system", S name SN', |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1953 |
[('OneFetchStep', [('Any X,SN WHERE X is Card, X cw_source S, S name "system", ' |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1954 |
'S name SN', |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1955 |
[{'S': 'CWSource', 'SN': 'String', 'X': 'Card'}])], |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1956 |
None, None, [self.system], {}, []) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1957 |
]) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1958 |
|
6633
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
1959 |
def test_source_specified_1_2(self): |
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
1960 |
sols = [] |
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
1961 |
for sol in X_ALL_SOLS: |
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
1962 |
sol = sol.copy() |
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
1963 |
sol['S'] = 'CWSource' |
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
1964 |
sols.append(sol) |
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
1965 |
self._test('Any X WHERE X cw_source S, S name "cards"', |
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
1966 |
[('OneFetchStep', [('Any X WHERE X cw_source S, S name "cards"', |
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
1967 |
sols)], |
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
1968 |
None, None, |
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
1969 |
[self.system],{}, []) |
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
1970 |
]) |
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
1971 |
|
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1972 |
def test_source_specified_2_0(self): |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1973 |
self._test('Card X WHERE X cw_source S, NOT S eid 1', |
6649
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
1974 |
[('OneFetchStep', [('Any X WHERE X is Card', |
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
1975 |
[{'X': 'Card'}])], |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1976 |
None, None, |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1977 |
[self.cards],{}, []) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1978 |
]) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1979 |
self._test('Card X WHERE NOT X cw_source S, S eid 1', |
6649
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
1980 |
[('OneFetchStep', [('Any X WHERE X is Card', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1981 |
[{'X': 'Card'}])], |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1982 |
None, None, |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1983 |
[self.cards],{}, []) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1984 |
]) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1985 |
|
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1986 |
def test_source_specified_2_1(self): |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1987 |
self._test('Card X WHERE X cw_source S, NOT S name "system"', |
6649
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
1988 |
[('OneFetchStep', [('Any X WHERE X is Card', |
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
1989 |
[{'X': 'Card'}])], |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1990 |
None, None, |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1991 |
[self.cards],{}, []) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1992 |
]) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1993 |
self._test('Card X WHERE NOT X cw_source S, S name "system"', |
6649
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
1994 |
[('OneFetchStep', [('Any X WHERE X is Card', |
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
1995 |
[{'X': 'Card'}])], |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1996 |
None, None, |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1997 |
[self.cards],{}, []) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1998 |
]) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
1999 |
|
6649
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
2000 |
def test_source_specified_3_1(self): |
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
2001 |
self._test('Any X,XT WHERE X is Card, X title XT, X cw_source S, S name "cards"', |
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
2002 |
[('OneFetchStep', |
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
2003 |
[('Any X,XT WHERE X is Card, X title XT', |
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
2004 |
[{'X': 'Card', 'XT': 'String'}])], |
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
2005 |
None, None, [self.cards], {}, []) |
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
2006 |
]) |
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
2007 |
|
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
2008 |
def test_source_specified_3_2(self): |
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
2009 |
self.skipTest('oops') |
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
2010 |
self._test('Any STN WHERE X is Note, X type XT, X in_state ST, ST name STN, X cw_source S, S name "cards"', |
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
2011 |
[('OneFetchStep', |
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
2012 |
[('Any X,XT WHERE X is Card, X title XT', |
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
2013 |
[{'X': 'Card', 'XT': 'String'}])], |
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
2014 |
None, None, [self.cards], {}, []) |
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
2015 |
]) |
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
2016 |
|
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2017 |
def test_source_conflict_1(self): |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2018 |
self.repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
6796
e70ca9abfc51
[unittest2] update to unittest2 assertRaises api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6794
diff
changeset
|
2019 |
with self.assertRaises(BadRQLQuery) as cm: |
e70ca9abfc51
[unittest2] update to unittest2 assertRaises api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6794
diff
changeset
|
2020 |
self._test('Any X WHERE X cw_source S, S name "system", X eid %(x)s', |
e70ca9abfc51
[unittest2] update to unittest2 assertRaises api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6794
diff
changeset
|
2021 |
[], {'x': 999999}) |
e70ca9abfc51
[unittest2] update to unittest2 assertRaises api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6794
diff
changeset
|
2022 |
self.assertEqual(str(cm.exception), 'source conflict for term %(x)s') |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2023 |
|
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2024 |
def test_source_conflict_2(self): |
6796
e70ca9abfc51
[unittest2] update to unittest2 assertRaises api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6794
diff
changeset
|
2025 |
with self.assertRaises(BadRQLQuery) as cm: |
e70ca9abfc51
[unittest2] update to unittest2 assertRaises api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6794
diff
changeset
|
2026 |
self._test('Card X WHERE X cw_source S, S name "systeme"', []) |
e70ca9abfc51
[unittest2] update to unittest2 assertRaises api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6794
diff
changeset
|
2027 |
self.assertEqual(str(cm.exception), 'source conflict for term X') |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2028 |
|
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2029 |
def test_source_conflict_3(self): |
6649
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
2030 |
self.skipTest('oops') |
6633
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
2031 |
self._test('CWSource X WHERE X cw_source S, S name "cards"', |
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
2032 |
[('OneFetchStep', |
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
2033 |
[(u'Any X WHERE X cw_source S, S name "cards", X is CWSource', |
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
2034 |
[{'S': 'CWSource', 'X': 'CWSource'}])], |
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
2035 |
None, None, |
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
2036 |
[self.system], |
7baea108d326
[ms] simplify cw_source handling : don't try evil optmization that may hurt in some cases
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6631
diff
changeset
|
2037 |
{}, [])]) |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2038 |
|
6649
29f8e5c35392
[ms planning] fix/enhance cw_source consideration in ms planning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6633
diff
changeset
|
2039 |
|
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2040 |
def test_ambigous_cross_relation_source_specified(self): |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2041 |
self.repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2042 |
self.cards.support_relations['see_also'] = True |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2043 |
self.cards.cross_relations.add('see_also') |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2044 |
try: |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2045 |
self._test('Any X,AA ORDERBY AA WHERE E eid %(x)s, E see_also X, X modification_date AA', |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2046 |
[('AggrStep', |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2047 |
'SELECT table0.C0, table0.C1 FROM table0 ORDER BY table0.C1', |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2048 |
None, |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2049 |
[('FetchStep', |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2050 |
[('Any X,AA WHERE 999999 see_also X, X modification_date AA, X is Note', |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2051 |
[{'AA': 'Datetime', 'X': 'Note'}])], [self.cards, self.system], {}, |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2052 |
{'AA': 'table0.C1', 'X': 'table0.C0', |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2053 |
'X.modification_date': 'table0.C1'}, |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2054 |
[]), |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2055 |
('FetchStep', |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2056 |
[('Any X,AA WHERE 999999 see_also X, X modification_date AA, X is Bookmark', |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2057 |
[{'AA': 'Datetime', 'X': 'Bookmark'}])], |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2058 |
[self.system], {}, |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2059 |
{'AA': 'table0.C1', 'X': 'table0.C0', |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2060 |
'X.modification_date': 'table0.C1'}, |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2061 |
[])])], |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2062 |
{'x': 999999}) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2063 |
finally: |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2064 |
del self.cards.support_relations['see_also'] |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2065 |
self.cards.cross_relations.remove('see_also') |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2066 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2067 |
# non regression tests #################################################### |
1785 | 2068 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2069 |
def test_nonregr1(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2070 |
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
|
2071 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
2072 |
[('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
|
2073 |
[self.ldap, self.system], None, {'X': 'table0.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2074 |
('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
2075 |
[('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
|
2076 |
[self.ldap, self.system], None, {'Y': 'table1.C0'}, []), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2077 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
2078 |
[('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
|
2079 |
[{'X': 'CWUser', 'Y': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2080 |
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
|
2081 |
]) |
1785 | 2082 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2083 |
def test_nonregr2(self): |
5556
9ab2b4c74baf
[entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
2084 |
iworkflowable = self.session.user.cw_adapt_to('IWorkflowable') |
9ab2b4c74baf
[entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
2085 |
iworkflowable.fire_transition('deactivate') |
9ab2b4c74baf
[entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
2086 |
treid = iworkflowable.latest_trinfo().eid |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2087 |
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
|
2088 |
[('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
|
2089 |
[{'X': 'Note', 'D': 'Datetime'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2090 |
[self.cards, 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
|
2091 |
('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
|
2092 |
[{'X': 'CWUser', 'D': 'Datetime'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2093 |
[self.ldap, self.system], None, {'X': 'table1.C0', 'X.modification_date': 'table1.C1', 'D': 'table1.C1'}, []), |
5768
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
2094 |
('AggrStep', 'SELECT table2.C0 FROM table2 ORDER BY table2.C1 DESC', None, [ |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2095 |
('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
|
2096 |
[{'X': 'Affaire', 'E': 'TrInfo', 'D': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2097 |
[self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2098 |
{}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2099 |
{'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
|
2100 |
('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
|
2101 |
[{'X': 'CWUser', 'E': 'TrInfo', 'D': 'Datetime'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2102 |
[self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2103 |
{'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
|
2104 |
{'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
|
2105 |
('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
|
2106 |
[{'X': 'Note', 'E': 'TrInfo', 'D': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2107 |
[self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2108 |
{'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
|
2109 |
{'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
|
2110 |
]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2111 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2112 |
{'x': treid}) |
1785 | 2113 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2114 |
def test_nonregr3(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2115 |
# original jpl query: |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
2116 |
# 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
|
2117 |
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
|
2118 |
[('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
|
2119 |
[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
|
2120 |
('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
|
2121 |
[{'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
|
2122 |
5, None, [self.system], {'U': 'table0.C0'}, [])] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2123 |
) |
1785 | 2124 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2125 |
def test_nonregr4(self): |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2126 |
ueid = self.session.user.eid |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2127 |
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
|
2128 |
'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
|
2129 |
[#('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
|
2130 |
# [self.ldap, self.system], None, {'U': 'table0.C0'}, []), |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2131 |
('OneFetchStep', [('Any U ORDERBY D DESC WHERE WF wf_info_for %s, WF creation_date D, WF from_state FS, WF owned_by U?' % ueid, |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
2132 |
[{'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
|
2133 |
None, None, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2134 |
[self.system], {}, [])], |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2135 |
{'x': ueid}) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2136 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2137 |
def test_nonregr5(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2138 |
# original jpl query: |
1785 | 2139 |
# 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
|
2140 |
# 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
|
2141 |
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
|
2142 |
noteeid = self.execute('INSERT Note X')[0][0] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2143 |
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
|
2144 |
'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
|
2145 |
[('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
|
2146 |
[{'P': 'Note', 'V': 'Card'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2147 |
[self.cards, self.system], None, {'V': 'table0.C0'}, []), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2148 |
('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
|
2149 |
[{'B': 'Affaire', 'MB': 'Affaire', 'V': 'Card'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2150 |
None, None, [self.system], {'V': 'table0.C0'}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2151 |
{'x': cardeid, 'p': noteeid}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2152 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2153 |
def test_nonregr6(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2154 |
self._test('Any X WHERE X concerne Y', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2155 |
[('OneFetchStep', [('Any X WHERE X concerne Y', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2156 |
[{'Y': 'Division', 'X': 'Affaire'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2157 |
{'Y': 'Note', 'X': 'Affaire'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2158 |
{'Y': 'Societe', 'X': 'Affaire'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2159 |
{'Y': 'SubDivision', 'X': 'Affaire'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2160 |
{'Y': 'Affaire', 'X': 'Personne'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2161 |
None, None, [self.system], {}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2162 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2163 |
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
|
2164 |
[('FetchStep', [('Any Y WHERE Y is Note', [{'Y': 'Note'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2165 |
[self.cards, self.system], None, {'Y': 'table0.C0'}, []), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2166 |
('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
|
2167 |
[{'X': 'Affaire', 'Y': 'Note'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2168 |
None, None, [self.system], {'Y': 'table0.C0'}, []) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2169 |
]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2170 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2171 |
def test_nonregr7(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2172 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2173 |
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
|
2174 |
[('FetchStep', [('Any WP WHERE 999999 multisource_rel WP, WP is Note', [{'WP': 'Note'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2175 |
[self.cards], None, {'WP': u'table0.C0'}, []), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2176 |
('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', |
6081
ede33e6400ab
[forms] test abs() rql function
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
6057
diff
changeset
|
2177 |
[{'A': 'Affaire', 'DI': 'Datetime', 'DUR': 'Int', 'I': 'Float', 'S': 'State', 'SN': 'String', 'WP': 'Note'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2178 |
None, None, [self.system], {'WP': u'table0.C0'}, [])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2179 |
{'n': 999999}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2180 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2181 |
def test_nonregr8(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2182 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2183 |
self._test('Any X,Z WHERE X eid %(x)s, X multisource_rel Y, Z concerne X', |
6131
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
2184 |
[('FetchStep', [('Any 999999 WHERE 999999 multisource_rel Y, Y is Note', |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
2185 |
[{'Y': 'Note'}])], |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
2186 |
[self.cards], |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
2187 |
None, {u'%(x)s': 'table0.C0'}, |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
2188 |
[]), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2189 |
('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
|
2190 |
[{'Z': 'Affaire'}])], |
6131
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
2191 |
None, None, [self.system], |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
2192 |
{u'%(x)s': 'table0.C0'}, []), |
087c5a168010
[ms] more planning bug fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6129
diff
changeset
|
2193 |
], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2194 |
{'x': 999999}) |
1785 | 2195 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2196 |
def test_nonregr9(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2197 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2198 |
repo._type_source_cache[999998] = ('Note', 'cards', 999998) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2199 |
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
|
2200 |
[('FetchStep', [('Any Y WHERE Y multisource_rel 999998, Y is Note', [{'Y': 'Note'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2201 |
[self.cards], None, {'Y': u'table0.C0'}, []), |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2202 |
('UpdateStep', |
4764
ec9c20c6b9f7
[repo] improve planning of insert/update queries: do not select affected constants so the don't go and back to/from the source.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
2203 |
[('OneFetchStep', [('DISTINCT Any Y WHERE Y migrated_from 999998, Y is Note', |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2204 |
[{'Y': 'Note'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2205 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2206 |
{'Y': u'table0.C0'}, [])])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2207 |
{'x': 999999, 'z': 999998}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2208 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2209 |
def test_nonregr10(self): |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2210 |
repo._type_source_cache[999999] = ('CWUser', 'ldap', 999999) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2211 |
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
|
2212 |
[('FetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
2213 |
[('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
|
2214 |
[{'AA': 'String', 'AB': 'Datetime', 'X': 'CWUser'}])], |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2215 |
[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
|
2216 |
'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
|
2217 |
[]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2218 |
('OneFetchStep', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
2219 |
[('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
|
2220 |
[{'AA': 'String', 'AB': 'Datetime', 'X': 'CWUser'}])], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2221 |
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
|
2222 |
'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
|
2223 |
[]) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2224 |
], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2225 |
{'x': 999999}) |
1785 | 2226 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2227 |
def test_nonregr11(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2228 |
repo._type_source_cache[999999] = ('Bookmark', 'system', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2229 |
self._test('SET X bookmarked_by Y WHERE X eid %(x)s, Y login "hop"', |
4764
ec9c20c6b9f7
[repo] improve planning of insert/update queries: do not select affected constants so the don't go and back to/from the source.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
2230 |
[('UpdateStep', |
ec9c20c6b9f7
[repo] improve planning of insert/update queries: do not select affected constants so the don't go and back to/from the source.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
2231 |
[('OneFetchStep', [('DISTINCT Any Y WHERE Y login "hop", Y is CWUser', [{'Y': 'CWUser'}])], |
ec9c20c6b9f7
[repo] improve planning of insert/update queries: do not select affected constants so the don't go and back to/from the source.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4685
diff
changeset
|
2232 |
None, None, [self.ldap, self.system], {}, [])] |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2233 |
)], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2234 |
{'x': 999999}) |
1785 | 2235 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2236 |
def test_nonregr12(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2237 |
repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2238 |
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
|
2239 |
[('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
|
2240 |
[{'X': 'Note', 'Z': 'Datetime'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2241 |
[self.cards, 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
|
2242 |
[]), |
5768
1e73a466aa69
[fti] support for fti ranking: has_text query results sorted by relevance, and provides a way to control weight per entity / entity's attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5590
diff
changeset
|
2243 |
('AggrStep', 'SELECT table1.C0 FROM table1 ORDER BY table1.C1 DESC', None, |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2244 |
[('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
|
2245 |
[{'X': 'Bookmark', 'Z': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2246 |
[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
|
2247 |
'Z': 'table1.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2248 |
[]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2249 |
('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
|
2250 |
[{'X': 'Note', 'Z': 'Datetime'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2251 |
[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
|
2252 |
'Z': 'table0.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2253 |
{'X': 'table1.C0', 'X.modification_date': 'table1.C1', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2254 |
'Z': 'table1.C1'}, |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2255 |
[])] |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2256 |
)], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2257 |
{'x': 999999}) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2258 |
|
1121
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
2259 |
def test_nonregr13_1(self): |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2260 |
ueid = self.session.user.eid |
1122
9f37de24251f
fix rql2sq w/ outer join on subquery result
sylvain.thenault@logilab.fr
parents:
1121
diff
changeset
|
2261 |
# identity wrapped into exists: |
9f37de24251f
fix rql2sq w/ outer join on subquery result
sylvain.thenault@logilab.fr
parents:
1121
diff
changeset
|
2262 |
# 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
|
2263 |
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
|
2264 |
'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
|
2265 |
'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
|
2266 |
'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
|
2267 |
[('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
|
2268 |
[{'U': 'CWUser', 'UL': 'String'}])], |
1120
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
2269 |
[self.ldap, self.system], None, |
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
2270 |
{'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
|
2271 |
[]), |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2272 |
('FetchStep', [('Any U,UL WHERE ((EXISTS(U identity %s)) OR (EXISTS(U in_group G, G name IN("managers", "staff"), G is CWGroup))) OR (EXISTS(U in_group H, %s in_group H, NOT H name "users", H is CWGroup)), U login UL, U is CWUser' % (ueid, ueid), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
2273 |
[{'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
|
2274 |
[self.system], |
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
2275 |
{'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
|
2276 |
{'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
|
2277 |
[]), |
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
2278 |
('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
|
2279 |
[{'B': 'File', 'U': 'CWUser', 'UL': 'String'}])], |
1120
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
2280 |
None, None, [self.system], |
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
2281 |
{'U': 'table1.C0', 'UL': 'table1.C1'}, |
1c24cde4bf72
fix ms planning w/ relation constraint propagation
sylvain.thenault@logilab.fr
parents:
393
diff
changeset
|
2282 |
[])], |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2283 |
{'x': ueid}) |
1785 | 2284 |
|
1121
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
2285 |
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
|
2286 |
# 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
|
2287 |
# |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
2288 |
# 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
|
2289 |
# 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
|
2290 |
# 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
|
2291 |
# |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
2292 |
# 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
|
2293 |
# 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
|
2294 |
# 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
|
2295 |
# wrapped in exists() if used in multi-source |
6340
470d8e828fda
[test] update test to unittest2 api (still using lgc.testlib though)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6209
diff
changeset
|
2296 |
self.skipTest('take a look at me if you wish') |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2297 |
ueid = self.session.user.eid |
1121
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
2298 |
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
|
2299 |
'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
|
2300 |
'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
|
2301 |
'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
|
2302 |
[('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
|
2303 |
[{'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
|
2304 |
[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
|
2305 |
{'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
|
2306 |
[]), |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2307 |
('FetchStep', [('Any U,UL WHERE ((U identity %s) OR (EXISTS(U in_group G, G name IN("managers", "staff"), G is CWGroup))) OR (EXISTS(U in_group H, %s in_group H, NOT H name "users", H is CWGroup)), U login UL, U is CWUser' % (ueid, ueid), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1231
diff
changeset
|
2308 |
[{'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
|
2309 |
[self.system], |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
2310 |
{'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
|
2311 |
{'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
|
2312 |
[]), |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
2313 |
('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
|
2314 |
[{'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
|
2315 |
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
|
2316 |
{'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
|
2317 |
[])], |
43fa67acd9d0
one more test, but skipped in it may be a won't fix
sylvain.thenault@logilab.fr
parents:
1120
diff
changeset
|
2318 |
{'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
|
2319 |
|
2170
6adbc965c51b
fix jpl/ticket/34862: msplanner bug with query generated to check if a user from ldap is owned_by himself
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2165
diff
changeset
|
2320 |
def test_nonregr14_1(self): |
6adbc965c51b
fix jpl/ticket/34862: msplanner bug with query generated to check if a user from ldap is owned_by himself
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2165
diff
changeset
|
2321 |
repo._type_source_cache[999999] = ('CWUser', 'ldap', 999999) |
6adbc965c51b
fix jpl/ticket/34862: msplanner bug with query generated to check if a user from ldap is owned_by himself
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2165
diff
changeset
|
2322 |
self._test('Any X WHERE X eid %(x)s, X owned_by U, U eid %(u)s', |
6adbc965c51b
fix jpl/ticket/34862: msplanner bug with query generated to check if a user from ldap is owned_by himself
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2165
diff
changeset
|
2323 |
[('OneFetchStep', [('Any 999999 WHERE 999999 owned_by 999999', [{}])], |
6adbc965c51b
fix jpl/ticket/34862: msplanner bug with query generated to check if a user from ldap is owned_by himself
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2165
diff
changeset
|
2324 |
None, None, [self.system], {}, [])], |
6adbc965c51b
fix jpl/ticket/34862: msplanner bug with query generated to check if a user from ldap is owned_by himself
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2165
diff
changeset
|
2325 |
{'x': 999999, 'u': 999999}) |
6adbc965c51b
fix jpl/ticket/34862: msplanner bug with query generated to check if a user from ldap is owned_by himself
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2165
diff
changeset
|
2326 |
|
6adbc965c51b
fix jpl/ticket/34862: msplanner bug with query generated to check if a user from ldap is owned_by himself
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2165
diff
changeset
|
2327 |
def test_nonregr14_2(self): |
6adbc965c51b
fix jpl/ticket/34862: msplanner bug with query generated to check if a user from ldap is owned_by himself
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2165
diff
changeset
|
2328 |
repo._type_source_cache[999999] = ('CWUser', 'ldap', 999999) |
6adbc965c51b
fix jpl/ticket/34862: msplanner bug with query generated to check if a user from ldap is owned_by himself
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2165
diff
changeset
|
2329 |
repo._type_source_cache[999998] = ('Note', 'system', 999998) |
6adbc965c51b
fix jpl/ticket/34862: msplanner bug with query generated to check if a user from ldap is owned_by himself
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2165
diff
changeset
|
2330 |
self._test('Any X WHERE X eid %(x)s, X owned_by U, U eid %(u)s', |
6adbc965c51b
fix jpl/ticket/34862: msplanner bug with query generated to check if a user from ldap is owned_by himself
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2165
diff
changeset
|
2331 |
[('OneFetchStep', [('Any 999998 WHERE 999998 owned_by 999999', [{}])], |
6adbc965c51b
fix jpl/ticket/34862: msplanner bug with query generated to check if a user from ldap is owned_by himself
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2165
diff
changeset
|
2332 |
None, None, [self.system], {}, [])], |
6adbc965c51b
fix jpl/ticket/34862: msplanner bug with query generated to check if a user from ldap is owned_by himself
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2165
diff
changeset
|
2333 |
{'x': 999998, 'u': 999999}) |
6adbc965c51b
fix jpl/ticket/34862: msplanner bug with query generated to check if a user from ldap is owned_by himself
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2165
diff
changeset
|
2334 |
|
2180
bf2e81fb52be
one more test (see mrambourg error report. We should ensure the previous fix fix his case as well which include security injection of the rql)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2170
diff
changeset
|
2335 |
def test_nonregr14_3(self): |
bf2e81fb52be
one more test (see mrambourg error report. We should ensure the previous fix fix his case as well which include security injection of the rql)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2170
diff
changeset
|
2336 |
repo._type_source_cache[999999] = ('CWUser', 'system', 999999) |
bf2e81fb52be
one more test (see mrambourg error report. We should ensure the previous fix fix his case as well which include security injection of the rql)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2170
diff
changeset
|
2337 |
repo._type_source_cache[999998] = ('CWUser', 'ldap', 999998) |
bf2e81fb52be
one more test (see mrambourg error report. We should ensure the previous fix fix his case as well which include security injection of the rql)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2170
diff
changeset
|
2338 |
self._test('Any X WHERE X eid %(x)s, X owned_by U, U eid %(u)s', |
bf2e81fb52be
one more test (see mrambourg error report. We should ensure the previous fix fix his case as well which include security injection of the rql)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2170
diff
changeset
|
2339 |
[('OneFetchStep', [('Any 999998 WHERE 999998 owned_by 999999', [{}])], |
bf2e81fb52be
one more test (see mrambourg error report. We should ensure the previous fix fix his case as well which include security injection of the rql)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2170
diff
changeset
|
2340 |
None, None, [self.system], {}, [])], |
bf2e81fb52be
one more test (see mrambourg error report. We should ensure the previous fix fix his case as well which include security injection of the rql)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2170
diff
changeset
|
2341 |
{'x': 999998, 'u': 999999}) |
bf2e81fb52be
one more test (see mrambourg error report. We should ensure the previous fix fix his case as well which include security injection of the rql)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2170
diff
changeset
|
2342 |
|
3239
1ceac4cd4fb7
[ms] fix planning w/ query using identity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2920
diff
changeset
|
2343 |
def test_nonregr_identity_no_source_access_1(self): |
2688
afa99d53401c
[multi-source] test and fix msplanner regression
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2180
diff
changeset
|
2344 |
repo._type_source_cache[999999] = ('CWUser', 'ldap', 999998) |
afa99d53401c
[multi-source] test and fix msplanner regression
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2180
diff
changeset
|
2345 |
self._test('Any S WHERE S identity U, S eid %(s)s, U eid %(u)s', |
afa99d53401c
[multi-source] test and fix msplanner regression
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2180
diff
changeset
|
2346 |
[('OneFetchStep', [('Any 999999 WHERE 999999 identity 999999', [{}])], |
afa99d53401c
[multi-source] test and fix msplanner regression
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2180
diff
changeset
|
2347 |
None, None, [self.system], {}, [])], |
afa99d53401c
[multi-source] test and fix msplanner regression
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2180
diff
changeset
|
2348 |
{'s': 999999, 'u': 999999}) |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2349 |
|
3239
1ceac4cd4fb7
[ms] fix planning w/ query using identity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2920
diff
changeset
|
2350 |
def test_nonregr_identity_no_source_access_2(self): |
1ceac4cd4fb7
[ms] fix planning w/ query using identity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2920
diff
changeset
|
2351 |
repo._type_source_cache[999999] = ('EmailAddress', 'system', 999999) |
1ceac4cd4fb7
[ms] fix planning w/ query using identity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2920
diff
changeset
|
2352 |
repo._type_source_cache[999998] = ('CWUser', 'ldap', 999998) |
1ceac4cd4fb7
[ms] fix planning w/ query using identity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2920
diff
changeset
|
2353 |
self._test('Any X WHERE O use_email X, ((EXISTS(O identity U)) OR (EXISTS(O in_group G, G name IN("managers", "staff")))) OR (EXISTS(O in_group G2, U in_group G2, NOT G2 name "users")), X eid %(x)s, U eid %(u)s', |
1ceac4cd4fb7
[ms] fix planning w/ query using identity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2920
diff
changeset
|
2354 |
[('OneFetchStep', [('Any 999999 WHERE O use_email 999999, ((EXISTS(O identity 999998)) OR (EXISTS(O in_group G, G name IN("managers", "staff")))) OR (EXISTS(O in_group G2, 999998 in_group G2, NOT G2 name "users"))', |
1ceac4cd4fb7
[ms] fix planning w/ query using identity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2920
diff
changeset
|
2355 |
[{'G': 'CWGroup', 'G2': 'CWGroup', 'O': 'CWUser'}])], |
1ceac4cd4fb7
[ms] fix planning w/ query using identity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2920
diff
changeset
|
2356 |
None, None, [self.system], {}, [])], |
1ceac4cd4fb7
[ms] fix planning w/ query using identity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2920
diff
changeset
|
2357 |
{'x': 999999, 'u': 999998}) |
1ceac4cd4fb7
[ms] fix planning w/ query using identity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2920
diff
changeset
|
2358 |
|
1ceac4cd4fb7
[ms] fix planning w/ query using identity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2920
diff
changeset
|
2359 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2360 |
class MSPlannerTwoSameExternalSourcesTC(BasePlannerTC): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2361 |
"""test planner related feature on a 3-sources repository: |
1785 | 2362 |
|
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2363 |
* 2 rql sources supporting Card |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2364 |
""" |
1785 | 2365 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2366 |
def setUp(self): |
6631
26c303c3f1aa
[test] make test independant from the working directory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6427
diff
changeset
|
2367 |
self.__class__.repo = repo |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2368 |
self.setup() |
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2369 |
self.add_source(FakeCardSource, 'cards') |
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2370 |
self.add_source(FakeCardSource, 'cards2') |
3240
8604a15995d1
refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3239
diff
changeset
|
2371 |
self.planner = MSPlanner(self.o.schema, self.repo.vreg.rqlhelper) |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2372 |
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
|
2373 |
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
|
2374 |
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
|
2375 |
assert 'multisource_crossed_rel' in repo.sources_by_uri['cards'].cross_relations |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2376 |
_test = test_plan |
1785 | 2377 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2378 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2379 |
def test_linked_external_entities(self): |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2380 |
repo._type_source_cache[999999] = ('Tag', 'system', 999999) |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2381 |
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
|
2382 |
[('FetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2383 |
[('Any X,XT WHERE X title XT, X is Card', [{'X': 'Card', 'XT': 'String'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2384 |
[self.cards, self.cards2, self.system], |
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2385 |
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
|
2386 |
[]), |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2387 |
('OneFetchStep', |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2388 |
[('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
|
2389 |
[{'X': 'Card', 'XT': 'String'}])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2390 |
None, None, [self.system], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2391 |
{'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
|
2392 |
[])], |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2393 |
{'t': 999999}) |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2394 |
|
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2395 |
def test_version_depends_on(self): |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2396 |
self.repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2397 |
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
|
2398 |
[('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
|
2399 |
[{'AD': 'State', 'AE': 'String', 'X': 'Note'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2400 |
[self.cards, self.cards2, self.system], |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2401 |
None, {'AD': 'table0.C1', 'AD.name': 'table0.C2', |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2402 |
'AE': 'table0.C2', 'X': 'table0.C0'}, |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2403 |
[]), |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2404 |
('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
|
2405 |
[{'AD': 'State', 'AE': 'String', 'X': 'Note'}])], |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2406 |
None, None, [self.system], |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2407 |
{'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
|
2408 |
[])], |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2409 |
{'x': 999999}) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2410 |
|
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2411 |
def test_version_crossed_depends_on_1(self): |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2412 |
self.repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2413 |
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
|
2414 |
[('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
|
2415 |
[{'AD': 'State', 'AE': 'String', 'X': 'Note'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2416 |
[self.cards, self.cards2, self.system], |
1231
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2417 |
None, {'AD': 'table0.C1', 'AD.name': 'table0.C2', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2418 |
'AE': 'table0.C2', 'X': 'table0.C0'}, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2419 |
[]), |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2420 |
('UnionStep', None, None, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2421 |
[('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
|
2422 |
[{'AD': 'State', 'AE': 'String', 'X': 'Note'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2423 |
None, None, [self.cards], None, |
1231
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2424 |
[]), |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2425 |
('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
|
2426 |
[{'AD': 'State', 'AE': 'String', 'X': 'Note'}])], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2427 |
None, None, [self.system], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2428 |
{'AD': 'table0.C1', 'AD.name': 'table0.C2', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2429 |
'AE': 'table0.C2', 'X': 'table0.C0'}, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2430 |
[])] |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2431 |
)], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2432 |
{'x': 999999}) |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2433 |
|
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
2434 |
def test_version_crossed_depends_on_2(self): |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2435 |
self.repo._type_source_cache[999999] = ('Note', 'system', 999999) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2436 |
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
|
2437 |
[('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
|
2438 |
[{'AD': 'State', 'AE': 'String', 'X': 'Note'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2439 |
[self.cards, self.cards2, self.system], |
1230
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
2440 |
None, {'AD': 'table0.C1', 'AD.name': 'table0.C2', |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
2441 |
'AE': 'table0.C2', 'X': 'table0.C0'}, |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
2442 |
[]), |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
2443 |
('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
|
2444 |
[{'AD': 'State', 'AE': 'String', 'X': 'Note'}])], |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
2445 |
None, None, [self.system], |
232e16835fff
fix constant handling in sourcesterms + minor cleanup
sylvain.thenault@logilab.fr
parents:
1228
diff
changeset
|
2446 |
{'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
|
2447 |
[])], |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2448 |
{'x': 999999}) |
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2449 |
|
1231
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2450 |
def test_version_crossed_depends_on_3(self): |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2451 |
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
|
2452 |
[('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
|
2453 |
[{'AD': 'State', 'AE': 'String', 'X': 'Note'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2454 |
[self.cards, self.cards2, self.system], |
1231
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2455 |
None, {'AD': 'table0.C1', 'AD.name': 'table0.C2', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2456 |
'AE': 'table0.C2', 'X': 'table0.C0'}, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2457 |
[]), |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2458 |
('FetchStep', [('Any E WHERE E is Note', [{'E': 'Note'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2459 |
[self.cards, self.cards2, self.system], |
1231
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2460 |
None, {'E': 'table1.C0'}, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2461 |
[]), |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2462 |
('UnionStep', None, None, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2463 |
[('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
|
2464 |
[{'AD': 'State', 'AE': 'String', 'E': 'Note', 'X': 'Note'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2465 |
None, None, [self.cards, self.cards2], None, |
1231
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2466 |
[]), |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2467 |
('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
|
2468 |
[{'AD': 'State', 'AE': 'String', 'E': 'Note', 'X': 'Note'}])], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2469 |
None, None, [self.system], |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2470 |
{'AD': 'table0.C1', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2471 |
'AD.name': 'table0.C2', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2472 |
'AE': 'table0.C2', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2473 |
'E': 'table1.C0', |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2474 |
'X': 'table0.C0'}, |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2475 |
[])] |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2476 |
)] |
1457a545af03
more fix of cross relation handling
sylvain.thenault@logilab.fr
parents:
1230
diff
changeset
|
2477 |
) |
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2478 |
|
6794
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2479 |
def test_version_crossed_depends_on_4(self): |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2480 |
self._test('Any X,AD,AE WHERE EXISTS(E multisource_crossed_rel X), X in_state AD, AD name AE, E is Note', |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2481 |
[('FetchStep', |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2482 |
[('Any X,AD,AE WHERE X in_state AD, AD name AE, AD is State, X is Note', |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2483 |
[{'X': 'Note', 'AD': 'State', 'AE': 'String'}])], |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2484 |
[self.cards, self.cards2, self.system], None, |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2485 |
{'X': 'table0.C0', |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2486 |
'AD': 'table0.C1', |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2487 |
'AD.name': 'table0.C2', |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2488 |
'AE': 'table0.C2'}, |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2489 |
[]), |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2490 |
('FetchStep', |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2491 |
[('Any A WHERE E multisource_crossed_rel A, A is Note, E is Note', |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2492 |
[{'A': 'Note', 'E': 'Note'}])], |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2493 |
[self.cards, self.cards2, self.system], None, |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2494 |
{'A': 'table1.C0'}, |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2495 |
[]), |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2496 |
('OneFetchStep', |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2497 |
[('Any X,AD,AE WHERE EXISTS(X identity A), AD name AE, A is Note, AD is State, X is Note', |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2498 |
[{'A': 'Note', 'AD': 'State', 'AE': 'String', 'X': 'Note'}])], |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2499 |
None, None, |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2500 |
[self.system], |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2501 |
{'A': 'table1.C0', |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2502 |
'AD': 'table0.C1', |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2503 |
'AD.name': 'table0.C2', |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2504 |
'AE': 'table0.C2', |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2505 |
'X': 'table0.C0'}, |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2506 |
[] |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2507 |
)] |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2508 |
) |
140d42b41b31
[multi-sources] fix planning of crossed relation w/ some complex queries
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
2509 |
|
1786
eccd1885d42e
one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents:
1785
diff
changeset
|
2510 |
def test_nonregr_dont_cross_rel_source_filtering_1(self): |
eccd1885d42e
one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents:
1785
diff
changeset
|
2511 |
self.repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
eccd1885d42e
one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents:
1785
diff
changeset
|
2512 |
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
|
2513 |
[('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
|
2514 |
[{'S': 'State'}])], |
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2515 |
None, None, [self.cards], {}, [] |
1786
eccd1885d42e
one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents:
1785
diff
changeset
|
2516 |
)], |
eccd1885d42e
one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents:
1785
diff
changeset
|
2517 |
{'x': 999999}) |
eccd1885d42e
one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents:
1785
diff
changeset
|
2518 |
|
eccd1885d42e
one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents:
1785
diff
changeset
|
2519 |
def test_nonregr_dont_cross_rel_source_filtering_2(self): |
1785 | 2520 |
self.repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
2521 |
self._test('Any X,AA,AB WHERE E eid %(x)s, E in_state X, X name AA, X modification_date AB', |
|
2522 |
[('OneFetchStep', [('Any X,AA,AB WHERE 999999 in_state X, X name AA, X modification_date AB, X is State', |
|
2523 |
[{'AA': 'String', 'AB': 'Datetime', 'X': 'State'}])], |
|
2074
9e268cb6202e
enhance BasePlannerTC to ease subclasses definition
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
2524 |
None, None, [self.cards], {}, [] |
1785 | 2525 |
)], |
2526 |
{'x': 999999}) |
|
2527 |
||
2165
dd40c375044e
#344177: ms planning bug with "Any X WHERE X eid 123" and 123 coming from an external source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2114
diff
changeset
|
2528 |
def test_nonregr_eid_query(self): |
dd40c375044e
#344177: ms planning bug with "Any X WHERE X eid 123" and 123 coming from an external source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2114
diff
changeset
|
2529 |
self.repo._type_source_cache[999999] = ('Note', 'cards', 999999) |
dd40c375044e
#344177: ms planning bug with "Any X WHERE X eid 123" and 123 coming from an external source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2114
diff
changeset
|
2530 |
self._test('Any X WHERE X eid 999999', |
dd40c375044e
#344177: ms planning bug with "Any X WHERE X eid 123" and 123 coming from an external source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2114
diff
changeset
|
2531 |
[('OneFetchStep', [('Any 999999', [{}])], |
dd40c375044e
#344177: ms planning bug with "Any X WHERE X eid 123" and 123 coming from an external source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2114
diff
changeset
|
2532 |
None, None, [self.system], {}, [] |
dd40c375044e
#344177: ms planning bug with "Any X WHERE X eid 123" and 123 coming from an external source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2114
diff
changeset
|
2533 |
)], |
dd40c375044e
#344177: ms planning bug with "Any X WHERE X eid 123" and 123 coming from an external source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2114
diff
changeset
|
2534 |
{'x': 999999}) |
dd40c375044e
#344177: ms planning bug with "Any X WHERE X eid 123" and 123 coming from an external source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2114
diff
changeset
|
2535 |
|
1228
91ae10ffb611
* refactor ms planner (renaming, reorganization)
sylvain.thenault@logilab.fr
parents:
1122
diff
changeset
|
2536 |
|
6056
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2537 |
def test_nonregr_not_is(self): |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2538 |
self._test("Any X WHERE X owned_by U, U login 'anon', NOT X is Comment", |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2539 |
[('FetchStep', [('Any X WHERE X is IN(Card, Note, State)', |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2540 |
[{'X': 'Note'}, {'X': 'State'}, {'X': 'Card'}])], |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2541 |
[self.cards, self.cards2, self.system], |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2542 |
None, {'X': 'table0.C0'}, []), |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2543 |
('UnionStep', None, None, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2544 |
[('OneFetchStep', |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2545 |
[(u'Any X WHERE X owned_by U, U login "anon", U is CWUser, X is IN(Affaire, BaseTransition, Basket, Bookmark, CWAttribute, CWCache, CWConstraint, CWConstraintType, CWEType, CWGroup, CWPermission, CWProperty, CWRType, CWRelation, CWSource, CWSourceHostConfig, CWUniqueTogetherConstraint, CWUser, Division, Email, EmailAddress, EmailPart, EmailThread, ExternalUri, File, Folder, Personne, RQLExpression, Societe, SubDivision, SubWorkflowExitPoint, Tag, TrInfo, Transition, Workflow, WorkflowTransition)', |
6056
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2546 |
[{'U': 'CWUser', 'X': 'Affaire'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2547 |
{'U': 'CWUser', 'X': 'BaseTransition'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2548 |
{'U': 'CWUser', 'X': 'Basket'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2549 |
{'U': 'CWUser', 'X': 'Bookmark'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2550 |
{'U': 'CWUser', 'X': 'CWAttribute'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2551 |
{'U': 'CWUser', 'X': 'CWCache'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2552 |
{'U': 'CWUser', 'X': 'CWConstraint'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2553 |
{'U': 'CWUser', 'X': 'CWConstraintType'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2554 |
{'U': 'CWUser', 'X': 'CWEType'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2555 |
{'U': 'CWUser', 'X': 'CWGroup'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2556 |
{'U': 'CWUser', 'X': 'CWPermission'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2557 |
{'U': 'CWUser', 'X': 'CWProperty'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2558 |
{'U': 'CWUser', 'X': 'CWRType'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2559 |
{'U': 'CWUser', 'X': 'CWRelation'}, |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2560 |
{'U': 'CWUser', 'X': 'CWSource'}, |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
2561 |
{'U': 'CWUser', 'X': 'CWSourceHostConfig'}, |
6209 | 2562 |
{'U': 'CWUser', 'X': 'CWUniqueTogetherConstraint'}, |
6056
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2563 |
{'U': 'CWUser', 'X': 'CWUser'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2564 |
{'U': 'CWUser', 'X': 'Division'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2565 |
{'U': 'CWUser', 'X': 'Email'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2566 |
{'U': 'CWUser', 'X': 'EmailAddress'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2567 |
{'U': 'CWUser', 'X': 'EmailPart'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2568 |
{'U': 'CWUser', 'X': 'EmailThread'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2569 |
{'U': 'CWUser', 'X': 'ExternalUri'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2570 |
{'U': 'CWUser', 'X': 'File'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2571 |
{'U': 'CWUser', 'X': 'Folder'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2572 |
{'U': 'CWUser', 'X': 'Personne'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2573 |
{'U': 'CWUser', 'X': 'RQLExpression'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2574 |
{'U': 'CWUser', 'X': 'Societe'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2575 |
{'U': 'CWUser', 'X': 'SubDivision'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2576 |
{'U': 'CWUser', 'X': 'SubWorkflowExitPoint'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2577 |
{'U': 'CWUser', 'X': 'Tag'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2578 |
{'U': 'CWUser', 'X': 'TrInfo'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2579 |
{'U': 'CWUser', 'X': 'Transition'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2580 |
{'U': 'CWUser', 'X': 'Workflow'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2581 |
{'U': 'CWUser', 'X': 'WorkflowTransition'}])], |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2582 |
None, None, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2583 |
[self.system], {}, []), |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2584 |
('OneFetchStep', |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2585 |
[(u'Any X WHERE X owned_by U, U login "anon", U is CWUser, X is IN(Card, Note, State)', |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2586 |
[{'U': 'CWUser', 'X': 'Note'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2587 |
{'U': 'CWUser', 'X': 'State'}, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2588 |
{'U': 'CWUser', 'X': 'Card'}])], |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2589 |
None, None, |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2590 |
[self.system], {'X': 'table0.C0'}, []) |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2591 |
]) |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2592 |
]) |
37a37e5ba330
[ms] fix a ms plannification bug with NOT is
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5768
diff
changeset
|
2593 |
|
2075
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2594 |
|
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2595 |
class FakeVCSSource(AbstractSource): |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2596 |
uri = 'ccc' |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2597 |
support_entities = {'Card': True, 'Note': True} |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2598 |
support_relations = {'multisource_inlined_rel': True, |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2599 |
'multisource_rel': True} |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2600 |
|
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2601 |
def syntax_tree_search(self, *args, **kwargs): |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2602 |
return [] |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2603 |
|
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2604 |
class MSPlannerVCSSource(BasePlannerTC): |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2605 |
|
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2606 |
def setUp(self): |
6631
26c303c3f1aa
[test] make test independant from the working directory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6427
diff
changeset
|
2607 |
self.__class__.repo = repo |
2075
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2608 |
self.setup() |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2609 |
self.add_source(FakeVCSSource, 'vcs') |
3240
8604a15995d1
refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3239
diff
changeset
|
2610 |
self.planner = MSPlanner(self.o.schema, self.repo.vreg.rqlhelper) |
2075
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2611 |
_test = test_plan |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2612 |
|
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2613 |
def test_multisource_inlined_rel_skipped(self): |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2614 |
self._test('Any MAX(VC) ' |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2615 |
'WHERE VC multisource_inlined_rel R2, R para %(branch)s, VC in_state S, S name "published", ' |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2616 |
'(EXISTS(R identity R2)) OR (EXISTS(R multisource_rel R2))', |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2617 |
[('FetchStep', [('Any VC WHERE VC multisource_inlined_rel R2, R para "???", (EXISTS(R identity R2)) OR (EXISTS(R multisource_rel R2)), R is Note, R2 is Note, VC is Note', |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2618 |
[{'R': 'Note', 'R2': 'Note', 'VC': 'Note'}])], |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2619 |
[self.vcs, self.system], None, |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2620 |
{'VC': 'table0.C0'}, |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2621 |
[]), |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2622 |
('OneFetchStep', [(u'Any MAX(VC) WHERE VC in_state S, S name "published", S is State, VC is Note', |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2623 |
[{'S': 'State', 'VC': 'Note'}])], |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2624 |
None, None, [self.system], |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2625 |
{'VC': 'table0.C0'}, |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2626 |
[]) |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2627 |
]) |
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2628 |
|
2108
b3f6fa7ad59f
add test and fix for queries where all variables are simplified and come from an external source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2076
diff
changeset
|
2629 |
def test_fully_simplified_extsource(self): |
b3f6fa7ad59f
add test and fix for queries where all variables are simplified and come from an external source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2076
diff
changeset
|
2630 |
self.repo._type_source_cache[999998] = ('Note', 'vcs', 999998) |
b3f6fa7ad59f
add test and fix for queries where all variables are simplified and come from an external source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2076
diff
changeset
|
2631 |
self.repo._type_source_cache[999999] = ('Note', 'vcs', 999999) |
b3f6fa7ad59f
add test and fix for queries where all variables are simplified and come from an external source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2076
diff
changeset
|
2632 |
self._test('Any X, Y WHERE NOT X multisource_rel Y, X eid 999998, Y eid 999999', |
5582
3e133b29a1a4
[rql2sql] follow rql 0.26.1 changes: NOT nodes normalization, allowing simplification of sql generation, and fix #XXX
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
2633 |
[('OneFetchStep', [('Any 999998,999999 WHERE NOT EXISTS(999998 multisource_rel 999999)', [{}])], |
2108
b3f6fa7ad59f
add test and fix for queries where all variables are simplified and come from an external source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2076
diff
changeset
|
2634 |
None, None, [self.vcs], {}, []) |
b3f6fa7ad59f
add test and fix for queries where all variables are simplified and come from an external source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2076
diff
changeset
|
2635 |
]) |
b3f6fa7ad59f
add test and fix for queries where all variables are simplified and come from an external source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2076
diff
changeset
|
2636 |
|
2114
862f27d94af4
one more ms planning bug
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2108
diff
changeset
|
2637 |
def test_nonregr_fully_simplified_extsource(self): |
862f27d94af4
one more ms planning bug
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2108
diff
changeset
|
2638 |
self.repo._type_source_cache[999998] = ('Note', 'vcs', 999998) |
862f27d94af4
one more ms planning bug
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2108
diff
changeset
|
2639 |
self.repo._type_source_cache[999999] = ('Note', 'vcs', 999999) |
862f27d94af4
one more ms planning bug
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2108
diff
changeset
|
2640 |
self.repo._type_source_cache[1000000] = ('Note', 'system', 1000000) |
862f27d94af4
one more ms planning bug
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2108
diff
changeset
|
2641 |
self._test('DISTINCT Any T,FALSE,L,M WHERE L eid 1000000, M eid 999999, T eid 999998', |
862f27d94af4
one more ms planning bug
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2108
diff
changeset
|
2642 |
[('OneFetchStep', [('DISTINCT Any 999998,FALSE,1000000,999999', [{}])], |
862f27d94af4
one more ms planning bug
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2108
diff
changeset
|
2643 |
None, None, [self.system], {}, []) |
862f27d94af4
one more ms planning bug
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2108
diff
changeset
|
2644 |
]) |
862f27d94af4
one more ms planning bug
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2108
diff
changeset
|
2645 |
|
2075
933ccfce6e91
fix bug in multisource planner, w/ inlined relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2074
diff
changeset
|
2646 |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2647 |
if __name__ == '__main__': |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2648 |
from logilab.common.testlib import unittest_main |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2649 |
unittest_main() |