server/test/unittest_security.py
branchstable
changeset 9586 121c88b360d0
parent 9395 96dba2efd16d
child 9777 b2e47617a94e
child 9981 7099bbd685aa
equal deleted inserted replaced
9558:1a719ca9c585 9586:121c88b360d0
   541 
   541 
   542     def test_ambigous_ordered(self):
   542     def test_ambigous_ordered(self):
   543         with self.login('anon') as cu:
   543         with self.login('anon') as cu:
   544             names = [t for t, in cu.execute('Any N ORDERBY lower(N) WHERE X name N')]
   544             names = [t for t, in cu.execute('Any N ORDERBY lower(N) WHERE X name N')]
   545             self.assertEqual(names, sorted(names, key=lambda x: x.lower()))
   545             self.assertEqual(names, sorted(names, key=lambda x: x.lower()))
   546 
       
   547     def test_restrict_is_instance_ok(self):
       
   548         rset = self.execute('Any X WHERE X is_instance_of BaseTransition')
       
   549         rqlst = rset.syntax_tree()
       
   550         select = rqlst.children[0]
       
   551         x = select.get_selected_variables().next()
       
   552         self.assertRaises(RQLException, select.add_type_restriction,
       
   553                           x.variable, 'CWUser')
       
   554         select.add_type_restriction(x.variable, 'BaseTransition')
       
   555         select.add_type_restriction(x.variable, 'WorkflowTransition')
       
   556         self.assertEqual(rqlst.as_string(), 'Any X WHERE X is_instance_of WorkflowTransition')
       
   557 
       
   558     def test_restrict_is_instance_no_supported(self):
       
   559         rset = self.execute('Any X WHERE X is_instance_of IN(CWUser, CWGroup)')
       
   560         rqlst = rset.syntax_tree()
       
   561         select = rqlst.children[0]
       
   562         x = select.get_selected_variables().next()
       
   563         self.assertRaises(NotImplementedError, select.add_type_restriction,
       
   564                           x.variable, 'WorkflowTransition')
       
   565 
   546 
   566     def test_in_state_without_update_perm(self):
   547     def test_in_state_without_update_perm(self):
   567         """check a user change in_state without having update permission on the
   548         """check a user change in_state without having update permission on the
   568         subject
   549         subject
   569         """
   550         """