# HG changeset patch # User Adrien Di Mascio # Date 1248355031 -7200 # Node ID 5346d9f3d5ec0206cc2a6ecbfc4e722b9b6dd3fe # Parent 3648b718a0d351ce1a0c3c21b8c4d3166c011333 [tests] fixes (including two operations renaming) diff -r 3648b718a0d3 -r 5346d9f3d5ec server/schemahooks.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): diff -r 3648b718a0d3 -r 5346d9f3d5ec server/test/data/schema.py --- 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',)} diff -r 3648b718a0d3 -r 5346d9f3d5ec server/test/unittest_hookhelper.py --- 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)