author | sylvain.thenault@logilab.fr |
Wed, 29 Apr 2009 09:03:31 +0200 | |
branch | tls-sprint |
changeset 1530 | 849fd3d64f11 |
parent 1398 | 5fe84a5f7035 |
child 1802 | d628defebc17 |
permissions | -rw-r--r-- |
0 | 1 |
from cubicweb.devtools import init_test_database |
2 |
from cubicweb.devtools.repotest import BasePlannerTC, test_plan |
|
3 |
from cubicweb.server.ssplanner import SSPlanner |
|
4 |
||
5 |
# keep cnx so it's not garbage collected and the associated session is closed |
|
6 |
repo, cnx = init_test_database('sqlite') |
|
7 |
||
8 |
class SSPlannerTC(BasePlannerTC): |
|
9 |
repo = repo |
|
10 |
_test = test_plan |
|
11 |
||
12 |
def setUp(self): |
|
13 |
BasePlannerTC.setUp(self) |
|
14 |
self.planner = SSPlanner(self.o.schema, self.o._rqlhelper) |
|
15 |
self.system = self.o._repo.system_source |
|
16 |
||
17 |
def tearDown(self): |
|
18 |
BasePlannerTC.tearDown(self) |
|
19 |
||
20 |
def test_ordered_ambigous_sol(self): |
|
21 |
self._test('Any XN ORDERBY XN WHERE X name XN', |
|
22 |
[('OneFetchStep', [('Any XN ORDERBY XN WHERE X name XN', |
|
23 |
[{'X': 'Basket', 'XN': 'String'}, |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
47
diff
changeset
|
24 |
{'X': 'CWCache', 'XN': 'String'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
47
diff
changeset
|
25 |
{'X': 'CWConstraintType', 'XN': 'String'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
47
diff
changeset
|
26 |
{'X': 'CWEType', 'XN': 'String'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
47
diff
changeset
|
27 |
{'X': 'CWGroup', 'XN': 'String'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
47
diff
changeset
|
28 |
{'X': 'CWPermission', 'XN': 'String'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
47
diff
changeset
|
29 |
{'X': 'CWRType', 'XN': 'String'}, |
0 | 30 |
{'X': 'File', 'XN': 'String'}, |
31 |
{'X': 'Folder', 'XN': 'String'}, |
|
32 |
{'X': 'Image', 'XN': 'String'}, |
|
33 |
{'X': 'State', 'XN': 'String'}, |
|
34 |
{'X': 'Tag', u'XN': 'String'}, |
|
35 |
{'X': 'Transition', 'XN': 'String'}])], |
|
36 |
None, None, |
|
37 |
[self.system], None, [])]) |
|
38 |
||
39 |
def test_groupeded_ambigous_sol(self): |
|
40 |
self._test('Any XN,COUNT(X) GROUPBY XN WHERE X name XN', |
|
41 |
[('OneFetchStep', [('Any XN,COUNT(X) GROUPBY XN WHERE X name XN', |
|
42 |
[{'X': 'Basket', 'XN': 'String'}, |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
47
diff
changeset
|
43 |
{'X': 'CWCache', 'XN': 'String'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
47
diff
changeset
|
44 |
{'X': 'CWConstraintType', 'XN': 'String'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
47
diff
changeset
|
45 |
{'X': 'CWEType', 'XN': 'String'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
47
diff
changeset
|
46 |
{'X': 'CWGroup', 'XN': 'String'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
47
diff
changeset
|
47 |
{'X': 'CWPermission', 'XN': 'String'}, |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
47
diff
changeset
|
48 |
{'X': 'CWRType', 'XN': 'String'}, |
0 | 49 |
{'X': 'File', 'XN': 'String'}, |
50 |
{'X': 'Folder', 'XN': 'String'}, |
|
51 |
{'X': 'Image', 'XN': 'String'}, |
|
52 |
{'X': 'State', 'XN': 'String'}, |
|
53 |
{'X': 'Tag', u'XN': 'String'}, |
|
54 |
{'X': 'Transition', 'XN': 'String'}])], |
|
55 |
None, None, |
|
56 |
[self.system], None, [])]) |
|
57 |
||
58 |
if __name__ == '__main__': |
|
59 |
from logilab.common.testlib import unittest_main |
|
60 |
unittest_main() |