[tests] fixes (including two operations renaming)
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Thu, 23 Jul 2009 15:17:11 +0200
changeset 2455 5346d9f3d5ec
parent 2454 3648b718a0d3
child 2456 aa25d6b244c8
[tests] fixes (including two operations renaming)
server/schemahooks.py
server/test/data/schema.py
server/test/unittest_hookhelper.py
--- a/server/schemahooks.py	Thu Jul 23 15:15:29 2009 +0200
+++ b/server/schemahooks.py	Thu Jul 23 15:17:11 2009 +0200
@@ -189,7 +189,7 @@
     DeleteCWRTypeOp(session, name)
 
 
-class DelRelationDefOp(SchemaOperation):
+class DeleteRelationDefOp(SchemaOperation):
     """actually remove the relation definition from the application's schema"""
     def commit_event(self):
         subjtype, rtype, objtype = self.kobj
@@ -238,7 +238,7 @@
     # if this is the last instance, drop associated relation type
     if lastrel and not rteid in pendings:
         execute('DELETE CWRType X WHERE X eid %(x)s', {'x': rteid}, 'x')
-    DelRelationDefOp(session, (subjschema, rschema, objschema))
+    DeleteRelationDefOp(session, (subjschema, rschema, objschema))
 
 
 # addition ####################################################################
@@ -883,7 +883,7 @@
                 self.perm, erschema.type, self.group)
 
 
-class DelRQLExpressionPermissionOp(AddRQLExpressionPermissionOp):
+class DeleteRQLExpressionPermissionOp(AddRQLExpressionPermissionOp):
     """synchronize schema when a *_permission relation has been deleted from an rql expression"""
 
     def commit_event(self):
@@ -919,7 +919,7 @@
     else: # RQLExpression
         expr = session.execute('Any EXPR WHERE X eid %(x)s, X expression EXPR',
                                {'x': object}, 'x')[0][0]
-        DelRQLExpressionPermissionOp(session, perm, subject, expr)
+        DeleteRQLExpressionPermissionOp(session, perm, subject, expr)
 
 
 def rebuild_infered_relations(session, subject, rtype, object):
--- a/server/test/data/schema.py	Thu Jul 23 15:15:29 2009 +0200
+++ b/server/test/data/schema.py	Thu Jul 23 15:17:11 2009 +0200
@@ -63,8 +63,8 @@
     __specializes_schema__ = True
     travaille_subdivision = ObjectRelation('Personne')
 
-_euser = import_schema('base').CWUser
-_euser.__relations__[0].fulltextindexed = True
+from cubicweb.schemas.base import CWUser
+CWUser.get_relations('login').next().fulltextindexed = True
 
 class Note(EntityType):
     date = String(maxsize=10)
@@ -131,14 +131,14 @@
         'delete': ('managers', RRQLExpression('O owned_by U')),
         }
 
-class para(AttributeRelationType):
+class para(RelationType):
     permissions = {
         'read':   ('managers', 'users', 'guests'),
         'add':    ('managers', ERQLExpression('X in_state S, S name "todo"')),
         'delete': ('managers', ERQLExpression('X in_state S, S name "todo"')),
         }
 
-class test(AttributeRelationType):
+class test(RelationType):
     permissions = {'read': ('managers', 'users', 'guests'),
                    'delete': ('managers',),
                    'add': ('managers',)}
--- a/server/test/unittest_hookhelper.py	Thu Jul 23 15:15:29 2009 +0200
+++ b/server/test/unittest_hookhelper.py	Thu Jul 23 15:17:11 2009 +0200
@@ -41,7 +41,7 @@
         from cubicweb.server import hooks, schemahooks
         session = self.session
         op1 = hooks.DelayedDeleteOp(session)
-        op2 = schemahooks.DelErdefOp(session)
+        op2 = schemahooks.DeleteRelationDefOp(session)
         # equivalent operation generated by op2 but replace it here by op3 so we
         # can check the result...
         op3 = schemahooks.UpdateSchemaOp(session)