[test] check that we reject an rqlexpression in computed relation perms
authorJulien Cristau <julien.cristau@logilab.fr>
Tue, 28 Jul 2015 11:15:36 +0200
changeset 10554 c39749d14c53
parent 10553 1d824df4f2bd
child 10555 d8df2c7cff1a
[test] check that we reject an rqlexpression in computed relation perms
test/data/rqlexpr_on_computedrel.py
test/unittest_schema.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'),)}
+
+
--- 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):