def test_delegation(self):
        
        # Test allowed delegation
        self.assertRaises(PermissionDenied, self.objs[0].get_val_x2,
                          self.objs[0], user_kw=self.u2)
        self.assertRaises(PermissionDenied, self.objs[1].get_val_x2,
                          self.objs[1], user_kw=self.u2)
        
        give_permission_to(self.u2, "can_get_x2", self.objs[0],
                           giver=self.u1, delegatable=True)
        
        self.assertEqual(self.objs[0].get_val_x2(user_kw=self.u2), 2)
        self.assertRaises(PermissionDenied, self.objs[1].get_val_x2,
                          self.objs[1], user_kw=self.u2)

        give_permission_to(self.u2, "can_get_x2", self.objs[1],
                           giver=self.u1, delegatable=False)

        self.assertEqual(self.objs[1].get_val_x2(user_kw=self.u2), 2)
        
        # Test disallowed delegation
        self.assertRaises(PermissionCannotBeDelegated,
                          give_permission_to,
                          self.u1, "can_get_x3", self.objs[0],
                          giver=self.u2, delegatable=False)
        
        self.assertRaises(PermissionDenied, self.objs[0].get_val_x3_other_val,
                          self.objs[0], user_kw=self.u1)
        self.assertRaises(PermissionDenied, self.objs[1].get_val_x3_other_val,
                          self.objs[1], user_kw=self.u1)
        
        # Test cross delegation between types
        give_permission_to(self.u1, "can_get_x4", self.objs[0],
                           giver=self.o3, delegatable=False)
        
        self.assertEqual(self.objs[0].get_val_x4(test_kw=self.u1), 4)

        # Test delegation of delegated permission
        self.assertRaises(PermissionCannotBeDelegated,
                          give_permission_to,
                          self.u2, "can_get_x4", self.objs[0],
                          giver=self.u1, delegatable=False)
        
        give_permission_to(self.o3, "can_get_x2", self.objs[0],
                           giver=self.u2, delegatable=True)
takes no arguments
dataset/ETHPy150Open fp7-ofelia/ocf/optin_manager/src/python/openflow/common/permissions/tests/tests.py/TestObjectPermissions.test_delegation--crossover with--dataset/ETHPy150Open ProgVal/Limnoria/plugins/Status/plugin.py/Status.cpu