author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Tue, 18 Aug 2009 09:25:26 +0200 | |
changeset 2901 | 8f4d495c94c2 |
parent 2730 | bb6fcb8c5d71 |
child 2920 | 64322aa83a1d |
permissions | -rw-r--r-- |
0 | 1 |
"""unit tests for schema rql (de)serialization |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1787
diff
changeset
|
2 |
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
0 | 3 |
""" |
4 |
||
5 |
import sys |
|
6 |
from cStringIO import StringIO |
|
7 |
||
8 |
from logilab.common.testlib import TestCase, unittest_main |
|
9 |
||
10 |
from cubicweb.schema import CubicWebSchemaLoader |
|
11 |
from cubicweb.devtools import TestServerConfiguration |
|
12 |
||
13 |
loader = CubicWebSchemaLoader() |
|
14 |
config = TestServerConfiguration('data') |
|
15 |
config.bootstrap_cubes() |
|
16 |
schema = loader.load(config) |
|
17 |
||
18 |
from cubicweb.server.schemaserial import * |
|
1787 | 19 |
|
0 | 20 |
class Schema2RQLTC(TestCase): |
1787 | 21 |
|
0 | 22 |
def test_eschema2rql1(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
23 |
self.assertListEquals(list(eschema2rql(schema.eschema('CWAttribute'))), |
0 | 24 |
[ |
2447
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
25 |
('INSERT CWEType X: X description %(description)s,X final %(final)s,X name %(name)s', |
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2447
diff
changeset
|
26 |
{'description': u'define a final relation: link a final relation type from a non final entity to a final entity type. used to build the instance schema', |
2447
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
27 |
'name': u'CWAttribute', 'final': False}) |
0 | 28 |
]) |
1787 | 29 |
|
0 | 30 |
def test_eschema2rql2(self): |
31 |
self.assertListEquals(list(eschema2rql(schema.eschema('String'))), [ |
|
2447
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
32 |
('INSERT CWEType X: X description %(description)s,X final %(final)s,X name %(name)s', |
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
33 |
{'description': u'', 'final': True, 'name': u'String'})]) |
1787 | 34 |
|
0 | 35 |
def test_eschema2rql_specialization(self): |
36 |
self.assertListEquals(list(specialize2rql(schema)), |
|
37 |
[ |
|
38 |
('SET X specializes ET WHERE X name %(x)s, ET name %(et)s', |
|
39 |
{'x': 'Division', 'et': 'Societe'}), |
|
40 |
('SET X specializes ET WHERE X name %(x)s, ET name %(et)s', |
|
41 |
{'x': 'SubDivision', 'et': 'Division'})]) |
|
1787 | 42 |
|
0 | 43 |
def test_rschema2rql1(self): |
44 |
self.assertListEquals(list(rschema2rql(schema.rschema('relation_type'))), |
|
45 |
[ |
|
2447
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
46 |
('INSERT CWRType X: X description %(description)s,X final %(final)s,X fulltext_container %(fulltext_container)s,X inlined %(inlined)s,X name %(name)s,X symetric %(symetric)s', |
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
47 |
{'description': u'link a relation definition to its relation type', 'symetric': False, 'name': u'relation_type', 'final' : False, 'fulltext_container': None, 'inlined': True}), |
1787 | 48 |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
49 |
('INSERT CWRelation X: X cardinality %(cardinality)s,X composite %(composite)s,X description %(description)s,X ordernum %(ordernum)s,X relation_type ER,X from_entity SE,X to_entity OE WHERE SE name %(se)s,ER name %(rt)s,OE name %(oe)s', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
50 |
{'rt': 'relation_type', 'description': u'', 'composite': u'object', 'oe': 'CWRType', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
51 |
'ordernum': 1, 'cardinality': u'1*', 'se': 'CWRelation'}), |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
52 |
('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X WHERE CT name %(ctname)s, EDEF relation_type ER, EDEF from_entity SE, EDEF to_entity OE, ER name %(rt)s, SE name %(se)s, OE name %(oe)s, EDEF is CWRelation', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
53 |
{'rt': 'relation_type', 'oe': 'CWRType', 'ctname': u'RQLConstraint', 'se': 'CWRelation', 'value': u'O final FALSE'}), |
1787 | 54 |
|
55 |
('INSERT CWRelation X: X cardinality %(cardinality)s,X composite %(composite)s,X description %(description)s,X ordernum %(ordernum)s,X relation_type ER,X from_entity SE,X to_entity OE WHERE SE name %(se)s,ER name %(rt)s,OE name %(oe)s', |
|
56 |
{'rt': 'relation_type', 'description': u'', 'composite': u'object', 'oe': 'CWRType', |
|
57 |
'ordernum': 1, 'cardinality': u'1*', 'se': 'CWAttribute'}), |
|
58 |
('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X WHERE CT name %(ctname)s, EDEF relation_type ER, EDEF from_entity SE, EDEF to_entity OE, ER name %(rt)s, SE name %(se)s, OE name %(oe)s, EDEF is CWRelation', |
|
59 |
{'rt': 'relation_type', 'oe': 'CWRType', 'ctname': u'RQLConstraint', 'se': 'CWAttribute', 'value': u'O final TRUE'}), |
|
0 | 60 |
]) |
1787 | 61 |
|
0 | 62 |
def test_rschema2rql2(self): |
1787 | 63 |
self.assertListEquals(list(rschema2rql(schema.rschema('add_permission'))), |
64 |
[ |
|
2447
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
65 |
('INSERT CWRType X: X description %(description)s,X final %(final)s,X fulltext_container %(fulltext_container)s,X inlined %(inlined)s,X name %(name)s,X symetric %(symetric)s', {'description': u'core relation giving to a group the permission to add an entity or relation type', 'symetric': False, 'name': u'add_permission', 'final': False, 'fulltext_container': None, 'inlined': False}), |
1787 | 66 |
|
67 |
('INSERT CWRelation X: X cardinality %(cardinality)s,X composite %(composite)s,X description %(description)s,X ordernum %(ordernum)s,X relation_type ER,X from_entity SE,X to_entity OE WHERE SE name %(se)s,ER name %(rt)s,OE name %(oe)s', |
|
68 |
{'rt': 'add_permission', 'description': u'groups allowed to add entities/relations of this type', 'composite': None, 'oe': 'CWGroup', 'ordernum': 3, 'cardinality': u'**', 'se': 'CWEType'}), |
|
69 |
('INSERT CWRelation X: X cardinality %(cardinality)s,X composite %(composite)s,X description %(description)s,X ordernum %(ordernum)s,X relation_type ER,X from_entity SE,X to_entity OE WHERE SE name %(se)s,ER name %(rt)s,OE name %(oe)s', |
|
70 |
{'rt': 'add_permission', 'description': u'groups allowed to add entities/relations of this type', 'composite': None, 'oe': 'CWGroup', 'ordernum': 3, 'cardinality': u'**', 'se': 'CWRType'}), |
|
71 |
||
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
72 |
('INSERT CWRelation X: X cardinality %(cardinality)s,X composite %(composite)s,X description %(description)s,X ordernum %(ordernum)s,X relation_type ER,X from_entity SE,X to_entity OE WHERE SE name %(se)s,ER name %(rt)s,OE name %(oe)s', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
73 |
{'rt': 'add_permission', 'description': u'rql expression allowing to add entities/relations of this type', 'composite': 'subject', 'oe': 'RQLExpression', 'ordernum': 5, 'cardinality': u'*?', 'se': 'CWEType'}), |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
74 |
('INSERT CWRelation X: X cardinality %(cardinality)s,X composite %(composite)s,X description %(description)s,X ordernum %(ordernum)s,X relation_type ER,X from_entity SE,X to_entity OE WHERE SE name %(se)s,ER name %(rt)s,OE name %(oe)s', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
75 |
{'rt': 'add_permission', 'description': u'rql expression allowing to add entities/relations of this type', 'composite': 'subject', 'oe': 'RQLExpression', 'ordernum': 5, 'cardinality': u'*?', 'se': 'CWRType'}), |
1787 | 76 |
]) |
77 |
||
0 | 78 |
def test_rschema2rql3(self): |
1787 | 79 |
self.assertListEquals(list(rschema2rql(schema.rschema('cardinality'))), |
0 | 80 |
[ |
2447
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
81 |
('INSERT CWRType X: X description %(description)s,X final %(final)s,X fulltext_container %(fulltext_container)s,X inlined %(inlined)s,X name %(name)s,X symetric %(symetric)s', |
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
82 |
{'description': u'', 'symetric': False, 'name': u'cardinality', 'final': True, 'fulltext_container': None, 'inlined': False}), |
0 | 83 |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
84 |
('INSERT CWAttribute X: X cardinality %(cardinality)s,X defaultval %(defaultval)s,X description %(description)s,X fulltextindexed %(fulltextindexed)s,X indexed %(indexed)s,X internationalizable %(internationalizable)s,X ordernum %(ordernum)s,X relation_type ER,X from_entity SE,X to_entity OE WHERE SE name %(se)s,ER name %(rt)s,OE name %(oe)s', |
1787 | 85 |
{'rt': 'cardinality', 'description': u'subject/object cardinality', 'internationalizable': True, 'fulltextindexed': False, 'ordernum': 5, 'defaultval': None, 'indexed': False, 'cardinality': u'?1', 'oe': 'String', 'se': 'CWRelation'}), |
86 |
('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X WHERE CT name %(ctname)s, EDEF relation_type ER, EDEF from_entity SE, EDEF to_entity OE, ER name %(rt)s, SE name %(se)s, OE name %(oe)s, EDEF is CWAttribute', |
|
87 |
{'rt': 'cardinality', 'oe': 'String', 'ctname': u'SizeConstraint', 'se': 'CWRelation', 'value': u'max=2'}), |
|
88 |
('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X WHERE CT name %(ctname)s, EDEF relation_type ER, EDEF from_entity SE, EDEF to_entity OE, ER name %(rt)s, SE name %(se)s, OE name %(oe)s, EDEF is CWAttribute', |
|
89 |
{'rt': 'cardinality', 'oe': 'String', 'ctname': u'StaticVocabularyConstraint', 'se': 'CWRelation', 'value': u"u'?*', u'1*', u'+*', u'**', u'?+', u'1+', u'++', u'*+', u'?1', u'11', u'+1', u'*1', u'??', u'1?', u'+?', u'*?'"}), |
|
90 |
||
91 |
('INSERT CWAttribute X: X cardinality %(cardinality)s,X defaultval %(defaultval)s,X description %(description)s,X fulltextindexed %(fulltextindexed)s,X indexed %(indexed)s,X internationalizable %(internationalizable)s,X ordernum %(ordernum)s,X relation_type ER,X from_entity SE,X to_entity OE WHERE SE name %(se)s,ER name %(rt)s,OE name %(oe)s', |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
92 |
{'rt': 'cardinality', 'description': u'subject/object cardinality', 'internationalizable': True, 'fulltextindexed': False, 'ordernum': 5, 'defaultval': None, 'indexed': False, 'cardinality': u'?1', 'oe': 'String', 'se': 'CWAttribute'}), |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
93 |
('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X WHERE CT name %(ctname)s, EDEF relation_type ER, EDEF from_entity SE, EDEF to_entity OE, ER name %(rt)s, SE name %(se)s, OE name %(oe)s, EDEF is CWAttribute', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
94 |
{'rt': 'cardinality', 'oe': 'String', 'ctname': u'SizeConstraint', 'se': 'CWAttribute', 'value': u'max=2'}), |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
95 |
('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X WHERE CT name %(ctname)s, EDEF relation_type ER, EDEF from_entity SE, EDEF to_entity OE, ER name %(rt)s, SE name %(se)s, OE name %(oe)s, EDEF is CWAttribute', |
2200
25bb65dc4559
test fixes, all server tests ok, except unittest_migractions (due to inter-tests-side-effects...)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
96 |
{'rt': 'cardinality', 'oe': 'String', 'ctname': u'StaticVocabularyConstraint', 'se': 'CWAttribute', 'value': u"u'?1', u'11'"}), |
1787 | 97 |
]) |
0 | 98 |
|
99 |
||
100 |
def test_updateeschema2rql1(self): |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
101 |
self.assertListEquals(list(updateeschema2rql(schema.eschema('CWAttribute'))), |
2447
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
102 |
[('SET X description %(description)s,X final %(final)s,X name %(name)s WHERE X is CWEType, X name %(et)s', |
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2447
diff
changeset
|
103 |
{'description': u'define a final relation: link a final relation type from a non final entity to a final entity type. used to build the instance schema', 'et': 'CWAttribute', 'final': False, 'name': u'CWAttribute'}), |
0 | 104 |
]) |
1787 | 105 |
|
0 | 106 |
def test_updateeschema2rql2(self): |
107 |
self.assertListEquals(list(updateeschema2rql(schema.eschema('String'))), |
|
2447
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
108 |
[('SET X description %(description)s,X final %(final)s,X name %(name)s WHERE X is CWEType, X name %(et)s', |
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
109 |
{'description': u'', 'et': 'String', 'final': True, 'name': u'String'}) |
0 | 110 |
]) |
1787 | 111 |
|
0 | 112 |
def test_updaterschema2rql1(self): |
113 |
self.assertListEquals(list(updaterschema2rql(schema.rschema('relation_type'))), |
|
114 |
[ |
|
2447
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
115 |
('SET X description %(description)s,X final %(final)s,X fulltext_container %(fulltext_container)s,X inlined %(inlined)s,X name %(name)s,X symetric %(symetric)s WHERE X is CWRType, X name %(rt)s', |
0 | 116 |
{'rt': 'relation_type', 'symetric': False, |
117 |
'description': u'link a relation definition to its relation type', |
|
2447
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
118 |
'final': False, 'fulltext_container': None, 'inlined': True, 'name': u'relation_type'}) |
0 | 119 |
]) |
1787 | 120 |
|
0 | 121 |
def test_updaterschema2rql2(self): |
122 |
expected = [ |
|
2447
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
123 |
('SET X description %(description)s,X final %(final)s,X fulltext_container %(fulltext_container)s,X inlined %(inlined)s,X name %(name)s,X symetric %(symetric)s WHERE X is CWRType, X name %(rt)s', |
0 | 124 |
{'rt': 'add_permission', 'symetric': False, |
125 |
'description': u'core relation giving to a group the permission to add an entity or relation type', |
|
2447
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
126 |
'final': False, 'fulltext_container': None, 'inlined': False, 'name': u'add_permission'}) |
0 | 127 |
] |
128 |
for i, (rql, args) in enumerate(updaterschema2rql(schema.rschema('add_permission'))): |
|
129 |
yield self.assertEquals, (rql, args), expected[i] |
|
130 |
||
131 |
class Perms2RQLTC(TestCase): |
|
132 |
GROUP_MAPPING = { |
|
133 |
'managers': 0, |
|
134 |
'users': 1, |
|
135 |
'guests': 2, |
|
136 |
'owners': 3, |
|
137 |
} |
|
1787 | 138 |
|
0 | 139 |
def test_eperms2rql1(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
140 |
self.assertListEquals([rql for rql, kwargs in erperms2rql(schema.eschema('CWEType'), self.GROUP_MAPPING)], |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
141 |
['SET X read_permission Y WHERE X is CWEType, X name "CWEType", Y eid 2', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
142 |
'SET X read_permission Y WHERE X is CWEType, X name "CWEType", Y eid 0', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
143 |
'SET X read_permission Y WHERE X is CWEType, X name "CWEType", Y eid 1', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
144 |
'SET X add_permission Y WHERE X is CWEType, X name "CWEType", Y eid 0', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
145 |
'SET X update_permission Y WHERE X is CWEType, X name "CWEType", Y eid 0', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
146 |
'SET X update_permission Y WHERE X is CWEType, X name "CWEType", Y eid 3', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
147 |
'SET X delete_permission Y WHERE X is CWEType, X name "CWEType", Y eid 0', |
0 | 148 |
]) |
1787 | 149 |
|
0 | 150 |
def test_rperms2rql2(self): |
151 |
self.assertListEquals([rql for rql, kwargs in erperms2rql(schema.rschema('read_permission'), self.GROUP_MAPPING)], |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
152 |
['SET X read_permission Y WHERE X is CWRType, X name "read_permission", Y eid 2', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
153 |
'SET X read_permission Y WHERE X is CWRType, X name "read_permission", Y eid 0', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
154 |
'SET X read_permission Y WHERE X is CWRType, X name "read_permission", Y eid 1', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
155 |
'SET X add_permission Y WHERE X is CWRType, X name "read_permission", Y eid 0', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
156 |
'SET X delete_permission Y WHERE X is CWRType, X name "read_permission", Y eid 0', |
0 | 157 |
]) |
1787 | 158 |
|
0 | 159 |
def test_rperms2rql3(self): |
160 |
self.assertListEquals([rql for rql, kwargs in erperms2rql(schema.rschema('name'), self.GROUP_MAPPING)], |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
161 |
['SET X read_permission Y WHERE X is CWRType, X name "name", Y eid 2', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
162 |
'SET X read_permission Y WHERE X is CWRType, X name "name", Y eid 0', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
163 |
'SET X read_permission Y WHERE X is CWRType, X name "name", Y eid 1', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
164 |
'SET X add_permission Y WHERE X is CWRType, X name "name", Y eid 2', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
165 |
'SET X add_permission Y WHERE X is CWRType, X name "name", Y eid 0', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
166 |
'SET X add_permission Y WHERE X is CWRType, X name "name", Y eid 1', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
167 |
'SET X delete_permission Y WHERE X is CWRType, X name "name", Y eid 2', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
168 |
'SET X delete_permission Y WHERE X is CWRType, X name "name", Y eid 0', |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
169 |
'SET X delete_permission Y WHERE X is CWRType, X name "name", Y eid 1', |
0 | 170 |
]) |
1787 | 171 |
|
0 | 172 |
#def test_perms2rql(self): |
173 |
# self.assertListEquals(perms2rql(schema, self.GROUP_MAPPING), |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
174 |
# ['INSERT CWEType X: X name 'Societe', X final FALSE']) |
1787 | 175 |
|
0 | 176 |
|
177 |
||
178 |
if __name__ == '__main__': |
|
179 |
unittest_main() |