server/test/unittest_schemaserial.py
changeset 9395 96dba2efd16d
parent 9299 c5eed908117d
child 9453 5c4d9dfbf176
child 9920 5aa730bf445e
equal deleted inserted replaced
9394:4b89ca0b11ad 9395:96dba2efd16d
   131             ('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 eid %(se)s,ER eid %(rt)s,OE eid %(oe)s',
   131             ('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 eid %(se)s,ER eid %(rt)s,OE eid %(oe)s',
   132              {'se': None, 'rt': None, 'oe': None,
   132              {'se': None, 'rt': None, 'oe': None,
   133               'description': u'groups allowed to add entities/relations of this type', 'composite': None, 'ordernum': 9999, 'cardinality': u'**'}),
   133               'description': u'groups allowed to add entities/relations of this type', 'composite': None, 'ordernum': 9999, 'cardinality': u'**'}),
   134             ('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 eid %(se)s,ER eid %(rt)s,OE eid %(oe)s',
   134             ('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 eid %(se)s,ER eid %(rt)s,OE eid %(oe)s',
   135              {'se': None, 'rt': None, 'oe': None,
   135              {'se': None, 'rt': None, 'oe': None,
   136               'description': u'rql expression allowing to add entities/relations of this type', 'composite': 'subject', 'ordernum': 9999, 'cardinality': u'*?'})],
   136               'description': u'rql expression allowing to add entities/relations of this type', 'composite': 'subject', 'ordernum': 9999, 'cardinality': u'*?'}),
       
   137             ('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 eid %(se)s,ER eid %(rt)s,OE eid %(oe)s',
       
   138             {'cardinality': u'**', 'composite': None, 'description': u'groups allowed to add entities/relations of this type',
       
   139              'oe': None, 'ordernum': 9999, 'rt': None, 'se': None}),
       
   140             ('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 eid %(se)s,ER eid %(rt)s,OE eid %(oe)s',
       
   141              {'cardinality': u'*?', 'composite': u'subject', 'description': u'rql expression allowing to add entities/relations of this type', 'oe': None, 'ordernum': 9999, 'rt': None, 'se': None})],
   137                              list(rschema2rql(schema.rschema('add_permission'), cstrtypemap)))
   142                              list(rschema2rql(schema.rschema('add_permission'), cstrtypemap)))
   138 
   143 
   139     def test_rschema2rql3(self):
   144     def test_rschema2rql3(self):
   140         self.assertListEqual([
   145         self.assertListEqual([
   141             ('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 symmetric %(symmetric)s',
   146             ('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 symmetric %(symmetric)s',
   264 
   269 
   265     def test_rperms2rql3(self):
   270     def test_rperms2rql3(self):
   266         self.assertListEqual([('SET X read_permission Y WHERE Y eid %(g)s, X eid %(x)s', {'g': 0}),
   271         self.assertListEqual([('SET X read_permission Y WHERE Y eid %(g)s, X eid %(x)s', {'g': 0}),
   267                               ('SET X read_permission Y WHERE Y eid %(g)s, X eid %(x)s', {'g': 1}),
   272                               ('SET X read_permission Y WHERE Y eid %(g)s, X eid %(x)s', {'g': 1}),
   268                               ('SET X read_permission Y WHERE Y eid %(g)s, X eid %(x)s', {'g': 2}),
   273                               ('SET X read_permission Y WHERE Y eid %(g)s, X eid %(x)s', {'g': 2}),
       
   274                               ('SET X add_permission Y WHERE Y eid %(g)s, X eid %(x)s', {'g': 0}),
   269                               ('SET X update_permission Y WHERE Y eid %(g)s, X eid %(x)s', {'g': 0})],
   275                               ('SET X update_permission Y WHERE Y eid %(g)s, X eid %(x)s', {'g': 0})],
   270                              [(rql, kwargs)
   276                              [(rql, kwargs)
   271                               for rql, kwargs in erperms2rql(schema.rschema('name').rdef('CWEType', 'String'),
   277                               for rql, kwargs in erperms2rql(schema.rschema('name').rdef('CWEType', 'String'),
   272                                                              self.GROUP_MAPPING)])
   278                                                              self.GROUP_MAPPING)])
   273 
   279