author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Fri, 26 Jun 2015 13:04:25 +0200 | |
changeset 10473 | 23a2fa8cb725 |
parent 9456 | a79e88aad555 |
permissions | -rw-r--r-- |
6957
ffda12be2e9f
[repository] #1460066: backport datafeed cube as cubicweb source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6781
diff
changeset
|
1 |
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
18 |
|
7977
e2d3ff3e7660
[test] drop some deprecation warnings
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6957
diff
changeset
|
19 |
from cubicweb.devtools import TestServerConfiguration, get_test_db_handler |
0 | 20 |
from cubicweb.devtools.repotest import BasePlannerTC, test_plan |
21 |
from cubicweb.server.ssplanner import SSPlanner |
|
22 |
||
2923
b97a0f8dd4dc
fix test schema and update some tests to work again with wf changes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2920
diff
changeset
|
23 |
# keep cnx so it's not garbage collected and the associated session closed |
6781
5062d86d6ffe
[unittest2] use unittest2 module fixture api
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6632
diff
changeset
|
24 |
def setUpModule(*args): |
6631
26c303c3f1aa
[test] make test independant from the working directory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
25 |
global repo, cnx |
7977
e2d3ff3e7660
[test] drop some deprecation warnings
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6957
diff
changeset
|
26 |
handler = get_test_db_handler(TestServerConfiguration( |
e2d3ff3e7660
[test] drop some deprecation warnings
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6957
diff
changeset
|
27 |
'data', apphome=SSPlannerTC.datadir)) |
e2d3ff3e7660
[test] drop some deprecation warnings
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6957
diff
changeset
|
28 |
handler.build_db_cache() |
e2d3ff3e7660
[test] drop some deprecation warnings
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6957
diff
changeset
|
29 |
global repo, cnx |
e2d3ff3e7660
[test] drop some deprecation warnings
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6957
diff
changeset
|
30 |
repo, cnx = handler.get_repo_and_cnx() |
0 | 31 |
|
6781
5062d86d6ffe
[unittest2] use unittest2 module fixture api
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6632
diff
changeset
|
32 |
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:
4252
diff
changeset
|
33 |
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:
4252
diff
changeset
|
34 |
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:
4252
diff
changeset
|
35 |
|
0 | 36 |
class SSPlannerTC(BasePlannerTC): |
37 |
_test = test_plan |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
38 |
|
0 | 39 |
def setUp(self): |
6631
26c303c3f1aa
[test] make test independant from the working directory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
40 |
self.__class__.repo = repo |
0 | 41 |
BasePlannerTC.setUp(self) |
3252
c0e10da6f1cf
tests update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2923
diff
changeset
|
42 |
self.planner = SSPlanner(self.o.schema, self.repo.vreg.rqlhelper) |
0 | 43 |
self.system = self.o._repo.system_source |
44 |
||
45 |
def tearDown(self): |
|
46 |
BasePlannerTC.tearDown(self) |
|
47 |
||
48 |
def test_ordered_ambigous_sol(self): |
|
3587 | 49 |
self._test('Any XN ORDERBY XN WHERE X name XN, X is IN (Basket, State, Folder)', |
50 |
[('OneFetchStep', [('Any XN ORDERBY XN WHERE X name XN, X is IN(Basket, State, Folder)', |
|
0 | 51 |
[{'X': 'Basket', 'XN': 'String'}, |
3587 | 52 |
{'X': 'State', 'XN': 'String'}, |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
53 |
{'X': 'Folder', 'XN': 'String'}])], |
9456
a79e88aad555
[multi-sources-removal] Kill repo.sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7977
diff
changeset
|
54 |
None, [])]) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
55 |
|
0 | 56 |
def test_groupeded_ambigous_sol(self): |
3587 | 57 |
self._test('Any XN,COUNT(X) GROUPBY XN WHERE X name XN, X is IN (Basket, State, Folder)', |
58 |
[('OneFetchStep', [('Any XN,COUNT(X) GROUPBY XN WHERE X name XN, X is IN(Basket, State, Folder)', |
|
0 | 59 |
[{'X': 'Basket', 'XN': 'String'}, |
3587 | 60 |
{'X': 'State', 'XN': 'String'}, |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
61 |
{'X': 'Folder', 'XN': 'String'}])], |
9456
a79e88aad555
[multi-sources-removal] Kill repo.sources
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7977
diff
changeset
|
62 |
None, [])]) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
63 |
|
0 | 64 |
if __name__ == '__main__': |
65 |
from logilab.common.testlib import unittest_main |
|
66 |
unittest_main() |