author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Fri, 31 Jul 2009 23:33:05 +0200 | |
changeset 2598 | a66fe74bd9fc |
parent 2476 | 1294a6bdf3bf |
child 2730 | bb6fcb8c5d71 |
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 |
loader.lib_directory = config.schemas_lib_dir() |
|
17 |
schema = loader.load(config) |
|
18 |
||
19 |
from cubicweb.server.schemaserial import * |
|
1787 | 20 |
|
0 | 21 |
class Schema2RQLTC(TestCase): |
1787 | 22 |
|
0 | 23 |
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
|
24 |
self.assertListEquals(list(eschema2rql(schema.eschema('CWAttribute'))), |
0 | 25 |
[ |
2447
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
26 |
('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
|
27 |
{'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
|
28 |
'name': u'CWAttribute', 'final': False}) |
0 | 29 |
]) |
1787 | 30 |
|
0 | 31 |
def test_eschema2rql2(self): |
32 |
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
|
33 |
('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
|
34 |
{'description': u'', 'final': True, 'name': u'String'})]) |
1787 | 35 |
|
0 | 36 |
def test_eschema2rql_specialization(self): |
37 |
self.assertListEquals(list(specialize2rql(schema)), |
|
38 |
[ |
|
39 |
('SET X specializes ET WHERE X name %(x)s, ET name %(et)s', |
|
40 |
{'x': 'Division', 'et': 'Societe'}), |
|
41 |
('SET X specializes ET WHERE X name %(x)s, ET name %(et)s', |
|
42 |
{'x': 'SubDivision', 'et': 'Division'})]) |
|
1787 | 43 |
|
0 | 44 |
def test_rschema2rql1(self): |
45 |
self.assertListEquals(list(rschema2rql(schema.rschema('relation_type'))), |
|
46 |
[ |
|
2447
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
47 |
('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
|
48 |
{'description': u'link a relation definition to its relation type', 'symetric': False, 'name': u'relation_type', 'final' : False, 'fulltext_container': None, 'inlined': True}), |
1787 | 49 |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
50 |
('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
|
51 |
{'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
|
52 |
'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
|
53 |
('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
|
54 |
{'rt': 'relation_type', 'oe': 'CWRType', 'ctname': u'RQLConstraint', 'se': 'CWRelation', 'value': u'O final FALSE'}), |
1787 | 55 |
|
56 |
('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', |
|
57 |
{'rt': 'relation_type', 'description': u'', 'composite': u'object', 'oe': 'CWRType', |
|
58 |
'ordernum': 1, 'cardinality': u'1*', 'se': 'CWAttribute'}), |
|
59 |
('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', |
|
60 |
{'rt': 'relation_type', 'oe': 'CWRType', 'ctname': u'RQLConstraint', 'se': 'CWAttribute', 'value': u'O final TRUE'}), |
|
0 | 61 |
]) |
1787 | 62 |
|
0 | 63 |
def test_rschema2rql2(self): |
1787 | 64 |
self.assertListEquals(list(rschema2rql(schema.rschema('add_permission'))), |
65 |
[ |
|
2447
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
66 |
('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 | 67 |
|
68 |
('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', |
|
69 |
{'rt': 'add_permission', 'description': u'groups allowed to add entities/relations of this type', 'composite': None, 'oe': 'CWGroup', 'ordernum': 3, 'cardinality': u'**', 'se': 'CWEType'}), |
|
70 |
('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', |
|
71 |
{'rt': 'add_permission', 'description': u'groups allowed to add entities/relations of this type', 'composite': None, 'oe': 'CWGroup', 'ordernum': 3, 'cardinality': u'**', 'se': 'CWRType'}), |
|
72 |
||
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
73 |
('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
|
74 |
{'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
|
75 |
('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
|
76 |
{'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 | 77 |
]) |
78 |
||
0 | 79 |
def test_rschema2rql3(self): |
1787 | 80 |
self.assertListEquals(list(rschema2rql(schema.rschema('cardinality'))), |
0 | 81 |
[ |
2447
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
82 |
('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
|
83 |
{'description': u'', 'symetric': False, 'name': u'cardinality', 'final': True, 'fulltext_container': None, 'inlined': False}), |
0 | 84 |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
85 |
('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 | 86 |
{'rt': 'cardinality', 'description': u'subject/object cardinality', 'internationalizable': True, 'fulltextindexed': False, 'ordernum': 5, 'defaultval': None, 'indexed': False, 'cardinality': u'?1', 'oe': 'String', 'se': 'CWRelation'}), |
87 |
('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', |
|
88 |
{'rt': 'cardinality', 'oe': 'String', 'ctname': u'SizeConstraint', 'se': 'CWRelation', 'value': u'max=2'}), |
|
89 |
('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', |
|
90 |
{'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'*?'"}), |
|
91 |
||
92 |
('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
|
93 |
{'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
|
94 |
('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
|
95 |
{'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
|
96 |
('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
|
97 |
{'rt': 'cardinality', 'oe': 'String', 'ctname': u'StaticVocabularyConstraint', 'se': 'CWAttribute', 'value': u"u'?1', u'11'"}), |
1787 | 98 |
]) |
0 | 99 |
|
100 |
||
101 |
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
|
102 |
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
|
103 |
[('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
|
104 |
{'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 | 105 |
]) |
1787 | 106 |
|
0 | 107 |
def test_updateeschema2rql2(self): |
108 |
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
|
109 |
[('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
|
110 |
{'description': u'', 'et': 'String', 'final': True, 'name': u'String'}) |
0 | 111 |
]) |
1787 | 112 |
|
0 | 113 |
def test_updaterschema2rql1(self): |
114 |
self.assertListEquals(list(updaterschema2rql(schema.rschema('relation_type'))), |
|
115 |
[ |
|
2447
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
116 |
('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 | 117 |
{'rt': 'relation_type', 'symetric': False, |
118 |
'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
|
119 |
'final': False, 'fulltext_container': None, 'inlined': True, 'name': u'relation_type'}) |
0 | 120 |
]) |
1787 | 121 |
|
0 | 122 |
def test_updaterschema2rql2(self): |
123 |
expected = [ |
|
2447
b83fcc2311af
fix schemaserial tests: meta doesn't exist anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2200
diff
changeset
|
124 |
('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 | 125 |
{'rt': 'add_permission', 'symetric': False, |
126 |
'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
|
127 |
'final': False, 'fulltext_container': None, 'inlined': False, 'name': u'add_permission'}) |
0 | 128 |
] |
129 |
for i, (rql, args) in enumerate(updaterschema2rql(schema.rschema('add_permission'))): |
|
130 |
yield self.assertEquals, (rql, args), expected[i] |
|
131 |
||
132 |
class Perms2RQLTC(TestCase): |
|
133 |
GROUP_MAPPING = { |
|
134 |
'managers': 0, |
|
135 |
'users': 1, |
|
136 |
'guests': 2, |
|
137 |
'owners': 3, |
|
138 |
} |
|
1787 | 139 |
|
0 | 140 |
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
|
141 |
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
|
142 |
['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
|
143 |
'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
|
144 |
'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
|
145 |
'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
|
146 |
'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
|
147 |
'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
|
148 |
'SET X delete_permission Y WHERE X is CWEType, X name "CWEType", Y eid 0', |
0 | 149 |
]) |
1787 | 150 |
|
0 | 151 |
def test_rperms2rql2(self): |
152 |
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
|
153 |
['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
|
154 |
'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
|
155 |
'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
|
156 |
'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
|
157 |
'SET X delete_permission Y WHERE X is CWRType, X name "read_permission", Y eid 0', |
0 | 158 |
]) |
1787 | 159 |
|
0 | 160 |
def test_rperms2rql3(self): |
161 |
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
|
162 |
['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
|
163 |
'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
|
164 |
'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
|
165 |
'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
|
166 |
'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
|
167 |
'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
|
168 |
'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
|
169 |
'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
|
170 |
'SET X delete_permission Y WHERE X is CWRType, X name "name", Y eid 1', |
0 | 171 |
]) |
1787 | 172 |
|
0 | 173 |
#def test_perms2rql(self): |
174 |
# 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
|
175 |
# ['INSERT CWEType X: X name 'Societe', X final FALSE']) |
1787 | 176 |
|
0 | 177 |
|
178 |
||
179 |
if __name__ == '__main__': |
|
180 |
unittest_main() |