# HG changeset patch # User Julien Cristau # Date 1438074936 -7200 # Node ID c39749d14c537eb41e67da42fa794caf0c88e45d # Parent 1d824df4f2bdb335ce9aed9c5c955bcbf192091e [test] check that we reject an rqlexpression in computed relation perms diff -r 1d824df4f2bd -r c39749d14c53 test/data/rqlexpr_on_computedrel.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/data/rqlexpr_on_computedrel.py Tue Jul 28 11:15:36 2015 +0200 @@ -0,0 +1,18 @@ +from yams.buildobjs import ComputedRelation, EntityType, RelationDefinition +from cubicweb.schema import RRQLExpression + +class Subject(EntityType): + pass + +class Object(EntityType): + pass + +class relation(RelationDefinition): + subject = 'Subject' + object = 'Object' + +class computed(ComputedRelation): + rule = 'S relation O' + __permissions__ = {'read': (RRQLExpression('S is ET'),)} + + diff -r 1d824df4f2bd -r c39749d14c53 test/unittest_schema.py --- a/test/unittest_schema.py Tue Jul 28 09:25:26 2015 +0200 +++ b/test/unittest_schema.py Tue Jul 28 11:15:36 2015 +0200 @@ -417,6 +417,10 @@ self._test('rrqlexpr_on_attr.py', "can't use RRQLExpression on attribute ToTo.attr[String], use an ERQLExpression") + def test_rqlexpr_on_computedrel(self): + self._test('rqlexpr_on_computedrel.py', + "can't use rql expression for read permission of relation Subject computed Object") + class NormalizeExpressionTC(TestCase):