server/test/unittest_migractions.py
branchstable
changeset 9600 bde625698f44
parent 9588 fe267b7336f3
parent 9565 fa00fc251d57
child 9635 aaf099172bb9
--- a/server/test/unittest_migractions.py	Tue Apr 01 14:46:55 2014 +0200
+++ b/server/test/unittest_migractions.py	Tue Apr 01 18:09:46 2014 +0200
@@ -364,6 +364,26 @@
             self.mh.cmd_change_relation_props('Personne', 'adel', 'String',
                                               fulltextindexed=False)
 
+    def test_sync_schema_props_perms_rqlconstraints(self):
+        # Drop one of the RQLConstraint.
+        rdef = self.schema['evaluee'].rdefs[('Personne', 'Note')]
+        oldconstraints = rdef.constraints
+        self.assertIn('S created_by U',
+                      [cstr.expression for cstr in oldconstraints])
+        self.mh.cmd_sync_schema_props_perms('evaluee', commit=True)
+        newconstraints = rdef.constraints
+        self.assertNotIn('S created_by U',
+                         [cstr.expression for cstr in newconstraints])
+
+        # Drop all RQLConstraint.
+        rdef = self.schema['travaille'].rdefs[('Personne', 'Societe')]
+        oldconstraints = rdef.constraints
+        self.assertEqual(len(oldconstraints), 2)
+        self.mh.cmd_sync_schema_props_perms('travaille', commit=True)
+        rdef = self.schema['travaille'].rdefs[('Personne', 'Societe')]
+        newconstraints = rdef.constraints
+        self.assertEqual(len(newconstraints), 0)
+
     @tag('longrun')
     def test_sync_schema_props_perms(self):
         cursor = self.mh.session