def test_delete_role(self): n = 'delete_role' r1 = self.role_api.create(n) self.assertFalse(r1 is None) authorization.delete_role(n) r2 = self.role_api.role(n) self.assertTrue(r2 is None)
def test_role_permission_delete(self): u = self._create_user() r = self._create_role() s = self._create_resource() o = authorization.READ n = authorization.operation_to_name(o) authorization.add_user_to_role(r['name'], u['login']) authorization.grant_permission_to_role(s, r['name'], [n]) self.assertTrue(authorization.is_authorized(s, u, o)) authorization.delete_role(r['name']) self.assertFalse(authorization.is_authorized(s, u, o))