author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Wed, 23 Sep 2009 11:03:57 +0200 | |
changeset 3404 | 9cb6b0cc2a7c |
parent 3204 | 0b766b8a13e1 |
child 3587 | 5b3725f315fc |
permissions | -rw-r--r-- |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
1 |
"""unit tests for module cubicweb.schema |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
2 |
|
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
3 |
:organization: Logilab |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
4 |
:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
5 |
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
6 |
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
7 |
""" |
0 | 8 |
|
9 |
import sys |
|
10 |
from os.path import join, isabs, basename, dirname |
|
11 |
||
12 |
from logilab.common.testlib import TestCase, unittest_main |
|
13 |
||
14 |
from rql import RQLSyntaxError |
|
15 |
||
16 |
from yams import BadSchemaDefinition |
|
17 |
from yams.constraints import SizeConstraint, StaticVocabularyConstraint |
|
18 |
from yams.buildobjs import RelationDefinition, EntityType, RelationType |
|
2635
c94df21f7ab2
F [cw.test] OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2456
diff
changeset
|
19 |
from yams.reader import PyFileReader |
0 | 20 |
|
21 |
from cubicweb.schema import CubicWebSchema, CubicWebEntitySchema, \ |
|
22 |
RQLConstraint, CubicWebSchemaLoader, ERQLExpression, RRQLExpression, \ |
|
2926
4484387ed012
when adding/removing cubes, we should add/remove entity types in correct order if one inherits from another
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2730
diff
changeset
|
23 |
normalize_expression, order_eschemas |
0 | 24 |
from cubicweb.devtools import TestServerConfiguration as TestConfiguration |
25 |
||
26 |
DATADIR = join(dirname(__file__), 'data') |
|
27 |
||
28 |
# build a dummy schema ######################################################## |
|
29 |
||
30 |
||
31 |
PERSONNE_PERMISSIONS = { |
|
32 |
'read': ('managers', 'users', 'guests'), |
|
33 |
'update': ('managers', 'owners'), |
|
34 |
'add': ('managers', ERQLExpression('X travaille S, S owned_by U')), |
|
35 |
'delete': ('managers', 'owners',), |
|
36 |
} |
|
37 |
||
38 |
CONCERNE_PERMISSIONS = { |
|
39 |
'read': ('managers', 'users', 'guests'), |
|
40 |
'add': ('managers', RRQLExpression('U has_update_permission S')), |
|
41 |
'delete': ('managers', RRQLExpression('O owned_by U')), |
|
42 |
} |
|
43 |
||
44 |
schema = CubicWebSchema('Test Schema') |
|
45 |
enote = schema.add_entity_type(EntityType('Note')) |
|
46 |
eaffaire = schema.add_entity_type(EntityType('Affaire')) |
|
47 |
eperson = schema.add_entity_type(EntityType('Personne', permissions=PERSONNE_PERMISSIONS)) |
|
48 |
esociete = schema.add_entity_type(EntityType('Societe')) |
|
49 |
||
50 |
RELS = ( |
|
51 |
# attribute relations |
|
52 |
('Note date String'), |
|
53 |
('Note type String'), |
|
54 |
('Affaire sujet String'), |
|
55 |
('Affaire ref String'), |
|
56 |
('Personne nom String'), |
|
57 |
('Personne prenom String'), |
|
58 |
('Personne sexe String'), |
|
59 |
('Personne tel Int'), |
|
60 |
('Personne fax Int'), |
|
61 |
('Personne datenaiss Date'), |
|
62 |
('Personne TEST Boolean'), |
|
63 |
('Personne promo String'), |
|
64 |
# real relations |
|
65 |
('Personne travaille Societe'), |
|
66 |
('Personne evaluee Note'), |
|
67 |
('Societe evaluee Note'), |
|
68 |
('Personne concerne Affaire'), |
|
69 |
('Personne concerne Societe'), |
|
70 |
('Affaire Concerne Societe'), |
|
71 |
) |
|
72 |
done = {} |
|
73 |
for rel in RELS: |
|
74 |
_from, _type, _to = rel.split() |
|
75 |
if not _type.lower() in done: |
|
76 |
if _type == 'concerne': |
|
77 |
schema.add_relation_type(RelationType(_type, permissions=CONCERNE_PERMISSIONS)) |
|
78 |
else: |
|
79 |
schema.add_relation_type(RelationType(_type)) |
|
80 |
done[_type.lower()] = True |
|
81 |
schema.add_relation_def(RelationDefinition(_from, _type, _to)) |
|
82 |
||
83 |
class CubicWebSchemaTC(TestCase): |
|
84 |
||
85 |
def test_normalize(self): |
|
86 |
"""test that entities, relations and attributes name are normalized |
|
87 |
""" |
|
88 |
self.assertEqual(esociete.type, 'Societe') |
|
89 |
self.assertEqual(schema.has_relation('TEST'), 0) |
|
90 |
self.assertEqual(schema.has_relation('test'), 1) |
|
91 |
self.assertEqual(eperson.subject_relation('test').type, 'test') |
|
92 |
self.assertEqual(schema.has_relation('Concerne'), 0) |
|
93 |
self.assertEqual(schema.has_relation('concerne'), 1) |
|
94 |
self.assertEqual(schema.rschema('concerne').type, 'concerne') |
|
95 |
||
96 |
def test_entity_perms(self): |
|
97 |
eperson.set_default_groups() |
|
98 |
self.assertEqual(eperson.get_groups('read'), set(('managers', 'users', 'guests'))) |
|
99 |
self.assertEqual(eperson.get_groups('update'), set(('managers', 'owners',))) |
|
100 |
self.assertEqual(eperson.get_groups('delete'), set(('managers', 'owners'))) |
|
101 |
self.assertEqual(eperson.get_groups('add'), set(('managers',))) |
|
102 |
self.assertEqual([str(e) for e in eperson.get_rqlexprs('add')], |
|
103 |
['Any X WHERE X travaille S, S owned_by U, X eid %(x)s, U eid %(u)s']) |
|
104 |
eperson.set_groups('read', ('managers',)) |
|
105 |
self.assertEqual(eperson.get_groups('read'), set(('managers',))) |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
106 |
|
0 | 107 |
def test_relation_perms(self): |
108 |
rconcerne = schema.rschema('concerne') |
|
109 |
rconcerne.set_default_groups() |
|
110 |
self.assertEqual(rconcerne.get_groups('read'), set(('managers', 'users', 'guests'))) |
|
111 |
self.assertEqual(rconcerne.get_groups('delete'), set(('managers',))) |
|
112 |
self.assertEqual(rconcerne.get_groups('add'), set(('managers', ))) |
|
113 |
rconcerne.set_groups('read', ('managers',)) |
|
114 |
self.assertEqual(rconcerne.get_groups('read'), set(('managers',))) |
|
115 |
self.assertEqual([str(e) for e in rconcerne.get_rqlexprs('add')], |
|
116 |
['Any S WHERE U has_update_permission S, S eid %(s)s, U eid %(u)s']) |
|
117 |
||
118 |
def test_erqlexpression(self): |
|
119 |
self.assertRaises(RQLSyntaxError, ERQLExpression, '1') |
|
120 |
expr = ERQLExpression('X travaille S, S owned_by U') |
|
121 |
self.assertEquals(str(expr), 'Any X WHERE X travaille S, S owned_by U, X eid %(x)s, U eid %(u)s') |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
122 |
|
0 | 123 |
def test_rrqlexpression(self): |
124 |
self.assertRaises(Exception, RRQLExpression, '1') |
|
125 |
self.assertRaises(RQLSyntaxError, RRQLExpression, 'O X Y') |
|
126 |
expr = RRQLExpression('U has_update_permission O') |
|
127 |
self.assertEquals(str(expr), 'Any O WHERE U has_update_permission O, O eid %(o)s, U eid %(u)s') |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
128 |
|
0 | 129 |
loader = CubicWebSchemaLoader() |
130 |
config = TestConfiguration('data') |
|
131 |
config.bootstrap_cubes() |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
132 |
|
2926
4484387ed012
when adding/removing cubes, we should add/remove entity types in correct order if one inherits from another
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2730
diff
changeset
|
133 |
class SchemaReaderClassTest(TestCase): |
4484387ed012
when adding/removing cubes, we should add/remove entity types in correct order if one inherits from another
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2730
diff
changeset
|
134 |
|
4484387ed012
when adding/removing cubes, we should add/remove entity types in correct order if one inherits from another
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2730
diff
changeset
|
135 |
def test_order_eschemas(self): |
4484387ed012
when adding/removing cubes, we should add/remove entity types in correct order if one inherits from another
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2730
diff
changeset
|
136 |
schema = loader.load(config) |
4484387ed012
when adding/removing cubes, we should add/remove entity types in correct order if one inherits from another
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2730
diff
changeset
|
137 |
self.assertEquals(order_eschemas([schema['Note'], schema['SubNote']]), |
4484387ed012
when adding/removing cubes, we should add/remove entity types in correct order if one inherits from another
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2730
diff
changeset
|
138 |
[schema['Note'], schema['SubNote']]) |
4484387ed012
when adding/removing cubes, we should add/remove entity types in correct order if one inherits from another
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2730
diff
changeset
|
139 |
self.assertEquals(order_eschemas([schema['SubNote'], schema['Note']]), |
4484387ed012
when adding/removing cubes, we should add/remove entity types in correct order if one inherits from another
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2730
diff
changeset
|
140 |
[schema['Note'], schema['SubNote']]) |
0 | 141 |
|
142 |
def test_knownValues_load_schema(self): |
|
143 |
schema = loader.load(config) |
|
144 |
self.assert_(isinstance(schema, CubicWebSchema)) |
|
145 |
self.assertEquals(schema.name, 'data') |
|
146 |
entities = [str(e) for e in schema.entities()] |
|
147 |
entities.sort() |
|
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2730
diff
changeset
|
148 |
expected_entities = ['BaseTransition', 'Bookmark', 'Boolean', 'Bytes', 'Card', |
0 | 149 |
'Date', 'Datetime', 'Decimal', |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
985
diff
changeset
|
150 |
'CWCache', 'CWConstraint', 'CWConstraintType', 'CWEType', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
985
diff
changeset
|
151 |
'CWAttribute', 'CWGroup', 'EmailAddress', 'CWRelation', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
985
diff
changeset
|
152 |
'CWPermission', 'CWProperty', 'CWRType', 'CWUser', |
2456
aa25d6b244c8
new cwuri metadata + a few tests fixes on the way
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
153 |
'ExternalUri', 'File', 'Float', 'Image', 'Int', 'Interval', 'Note', |
750
89e997bc2bf1
update test for new test schema
sylvain.thenault@logilab.fr
parents:
624
diff
changeset
|
154 |
'Password', 'Personne', |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
155 |
'RQLExpression', |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2730
diff
changeset
|
156 |
'Societe', 'State', 'String', 'SubNote', 'SubWorkflowExitPoint', |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2730
diff
changeset
|
157 |
'Tag', 'Time', 'Transition', 'TrInfo', |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2730
diff
changeset
|
158 |
'Workflow', 'WorkflowTransition'] |
0 | 159 |
self.assertListEquals(entities, sorted(expected_entities)) |
160 |
relations = [str(r) for r in schema.relations()] |
|
161 |
relations.sort() |
|
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2730
diff
changeset
|
162 |
expected_relations = ['add_permission', 'address', 'alias', 'allowed_transition', |
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2730
diff
changeset
|
163 |
'bookmarked_by', 'by_transition', |
0 | 164 |
|
3204
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2943
diff
changeset
|
165 |
'cardinality', 'comment', 'comment_format', |
750
89e997bc2bf1
update test for new test schema
sylvain.thenault@logilab.fr
parents:
624
diff
changeset
|
166 |
'composite', 'condition', 'connait', 'constrained_by', 'content', |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2730
diff
changeset
|
167 |
'content_format', 'created_by', 'creation_date', 'cstrtype', 'custom_workflow', 'cwuri', |
0 | 168 |
|
2943
77622caef9bd
[schema] default_workflow_of more naturally expressed as default_workflow
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2931
diff
changeset
|
169 |
'data', 'data_encoding', 'data_format', 'default_workflow', 'defaultval', 'delete_permission', |
750
89e997bc2bf1
update test for new test schema
sylvain.thenault@logilab.fr
parents:
624
diff
changeset
|
170 |
'description', 'description_format', 'destination_state', |
0 | 171 |
|
750
89e997bc2bf1
update test for new test schema
sylvain.thenault@logilab.fr
parents:
624
diff
changeset
|
172 |
'ecrit_par', 'eid', 'evaluee', 'expression', 'exprtype', |
0 | 173 |
|
174 |
'final', 'firstname', 'for_user', |
|
175 |
'from_entity', 'from_state', 'fulltext_container', 'fulltextindexed', |
|
176 |
||
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
177 |
'has_text', |
3204
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2943
diff
changeset
|
178 |
'identity', 'in_group', 'in_state', 'indexed', |
0 | 179 |
'initial_state', 'inlined', 'internationalizable', 'is', 'is_instance_of', |
180 |
||
181 |
'label', 'last_login_time', 'login', |
|
182 |
||
2456
aa25d6b244c8
new cwuri metadata + a few tests fixes on the way
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
183 |
'mainvars', 'modification_date', |
0 | 184 |
|
750
89e997bc2bf1
update test for new test schema
sylvain.thenault@logilab.fr
parents:
624
diff
changeset
|
185 |
'name', 'nom', |
0 | 186 |
|
187 |
'ordernum', 'owned_by', |
|
188 |
||
3204
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2943
diff
changeset
|
189 |
'path', 'pkey', 'prefered_form', 'prenom', 'primary_email', |
0 | 190 |
|
191 |
'read_permission', 'relation_type', 'require_group', |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
192 |
|
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2730
diff
changeset
|
193 |
'specializes', 'state_of', 'subworkflow', 'subworkflow_exit', 'subworkflow_state', 'surname', 'symetric', 'synopsis', |
0 | 194 |
|
750
89e997bc2bf1
update test for new test schema
sylvain.thenault@logilab.fr
parents:
624
diff
changeset
|
195 |
'tags', 'timestamp', 'title', 'to_entity', 'to_state', 'transition_of', 'travaille', 'type', |
0 | 196 |
|
2456
aa25d6b244c8
new cwuri metadata + a few tests fixes on the way
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
197 |
'upassword', 'update_permission', 'uri', 'use_email', |
0 | 198 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
199 |
'value', |
0 | 200 |
|
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2730
diff
changeset
|
201 |
'wf_info_for', 'wikiid', 'workflow_of'] |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
202 |
|
0 | 203 |
self.assertListEquals(relations, expected_relations) |
204 |
||
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
985
diff
changeset
|
205 |
eschema = schema.eschema('CWUser') |
0 | 206 |
rels = sorted(str(r) for r in eschema.subject_relations()) |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2730
diff
changeset
|
207 |
self.assertListEquals(rels, ['created_by', 'creation_date', 'custom_workflow', 'cwuri', 'eid', |
750
89e997bc2bf1
update test for new test schema
sylvain.thenault@logilab.fr
parents:
624
diff
changeset
|
208 |
'evaluee', 'firstname', 'has_text', 'identity', |
0 | 209 |
'in_group', 'in_state', 'is', |
210 |
'is_instance_of', 'last_login_time', |
|
211 |
'login', 'modification_date', 'owned_by', |
|
212 |
'primary_email', 'surname', 'upassword', |
|
213 |
'use_email']) |
|
214 |
rels = sorted(r.type for r in eschema.object_relations()) |
|
215 |
self.assertListEquals(rels, ['bookmarked_by', 'created_by', 'for_user', |
|
216 |
'identity', 'owned_by', 'wf_info_for']) |
|
217 |
rschema = schema.rschema('relation_type') |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
985
diff
changeset
|
218 |
properties = rschema.rproperties('CWAttribute', 'CWRType') |
0 | 219 |
self.assertEquals(properties['cardinality'], '1*') |
220 |
constraints = properties['constraints'] |
|
221 |
self.failUnlessEqual(len(constraints), 1, constraints) |
|
222 |
constraint = constraints[0] |
|
223 |
self.failUnless(isinstance(constraint, RQLConstraint)) |
|
224 |
self.failUnlessEqual(constraint.restriction, 'O final TRUE') |
|
225 |
||
226 |
def test_fulltext_container(self): |
|
227 |
schema = loader.load(config) |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
985
diff
changeset
|
228 |
self.failUnless('has_text' in schema['CWUser'].subject_relations()) |
0 | 229 |
self.failIf('has_text' in schema['EmailAddress'].subject_relations()) |
230 |
||
231 |
||
232 |
class BadSchemaRQLExprTC(TestCase): |
|
233 |
def setUp(self): |
|
234 |
self.loader = CubicWebSchemaLoader() |
|
235 |
self.loader.defined = {} |
|
951 | 236 |
self.loader.loaded_files = [] |
2635
c94df21f7ab2
F [cw.test] OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2456
diff
changeset
|
237 |
self.loader._pyreader = PyFileReader(self.loader) |
0 | 238 |
|
239 |
def _test(self, schemafile, msg): |
|
240 |
self.loader.handle_file(join(DATADIR, schemafile)) |
|
241 |
ex = self.assertRaises(BadSchemaDefinition, |
|
242 |
self.loader._build_schema, 'toto', False) |
|
243 |
self.assertEquals(str(ex), msg) |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
244 |
|
0 | 245 |
def test_rrqlexpr_on_etype(self): |
246 |
self._test('rrqlexpr_on_eetype.py', "can't use RRQLExpression on an entity type, use an ERQLExpression (ToTo)") |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
247 |
|
0 | 248 |
def test_erqlexpr_on_rtype(self): |
249 |
self._test('erqlexpr_on_ertype.py', "can't use ERQLExpression on a relation type, use a RRQLExpression (toto)") |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
250 |
|
0 | 251 |
def test_rqlexpr_on_rtype_read(self): |
252 |
self._test('rqlexpr_on_ertype_read.py', "can't use rql expression for read permission of a relation type (toto)") |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
253 |
|
0 | 254 |
def test_rrqlexpr_on_attr(self): |
255 |
self._test('rrqlexpr_on_attr.py', "can't use RRQLExpression on a final relation type (eg attribute relation), use an ERQLExpression (attr)") |
|
256 |
||
257 |
||
258 |
class NormalizeExpressionTC(TestCase): |
|
259 |
||
260 |
def test(self): |
|
261 |
self.assertEquals(normalize_expression('X bla Y,Y blur Z , Z zigoulou X '), |
|
262 |
'X bla Y, Y blur Z, Z zigoulou X') |
|
263 |
||
264 |
if __name__ == '__main__': |
|
265 |
unittest_main() |