def test_remove_access(self): project_id = '456' vtype = volume_types.create(self.ctxt, 'type1', projects=['456']) vtype_id = vtype.get('id') volume_types.remove_volume_type_access(self.ctxt, vtype_id, project_id) vtype_access = db.volume_type_access_get_all(self.ctxt, vtype_id) self.assertNotIn(project_id, vtype_access)
def _removeProjectAccess(self, req, id, body): context = req.environ['cinder.context'] context.authorize(policy.REMOVE_PROJECT_POLICY) project = body['removeProjectAccess']['project'] # Not found exception will be handled at the wsgi level volume_types.remove_volume_type_access(context, id, project) return webob.Response(status_int=http_client.ACCEPTED)
def test_remove_access(self): project_id = "456" vtype = volume_types.create(self.ctxt, "type1", projects=["456"], is_public=False) vtype_id = vtype.get("id") volume_types.remove_volume_type_access(self.ctxt, vtype_id, project_id) vtype_access = db.volume_type_access_get_all(self.ctxt, vtype_id) self.assertNotIn(project_id, vtype_access)
def test_remove_access(self): project_id = fake.PROJECT_ID vtype = volume_types.create(self.ctxt, 'type1', projects=[project_id], is_public=False) vtype_id = vtype.get('id') volume_types.remove_volume_type_access(self.ctxt, vtype_id, project_id) vtype_access = db.volume_type_access_get_all(self.ctxt, vtype_id) self.assertNotIn(project_id, vtype_access)
def _removeProjectAccess(self, req, id, body): context = req.environ['cinder.context'] authorize(context, action="removeProjectAccess") self._check_body(body, 'removeProjectAccess') project = body['removeProjectAccess']['project'] # Not found exception will be handled at the wsgi level volume_types.remove_volume_type_access(context, id, project) return webob.Response(status_int=http_client.ACCEPTED)
def test_remove_access_with_non_admin(self): self.ctxt = context.RequestContext("fake", "fake", is_admin=False) project_id = fake.PROJECT_ID vtype = volume_types.create(self.ctxt, "type1", projects=[project_id], is_public=False) vtype_id = vtype.get("id") volume_types.remove_volume_type_access(self.ctxt, vtype_id, project_id) vtype_access = db.volume_type_access_get_all(self.ctxt.elevated(), vtype_id) self.assertNotIn(project_id, vtype_access)
def _removeProjectAccess(self, req, id, body): context = req.environ['cinder.context'] authorize(context, action="removeProjectAccess") self._check_body(body, 'removeProjectAccess') project = body['removeProjectAccess']['project'] # Not found exception will be handled at the wsgi level volume_types.remove_volume_type_access(context, id, project) return webob.Response(status_int=202)
def test_remove_access_with_non_admin(self): self.ctxt = context.RequestContext('fake', 'fake', is_admin=False) project_id = fake.PROJECT_ID vtype = volume_types.create(self.ctxt, 'type1', projects=[project_id], is_public=False) vtype_id = vtype.get('id') volume_types.remove_volume_type_access(self.ctxt, vtype_id, project_id) vtype_access = db.volume_type_access_get_all(self.ctxt.elevated(), vtype_id) self.assertNotIn(project_id, vtype_access)
def _removeProjectAccess(self, req, id, body): context = req.environ["cinder.context"] authorize(context, action="removeProjectAccess") self._check_body(body, "removeProjectAccess") project = body["removeProjectAccess"]["project"] try: volume_types.remove_volume_type_access(context, id, project) except (exception.VolumeTypeNotFound, exception.VolumeTypeAccessNotFound) as err: raise webob.exc.HTTPNotFound(explanation=six.text_type(err)) return webob.Response(status_int=202)
def test_remove_access_with_non_admin(self): self.ctxt = context.RequestContext('fake', 'fake', is_admin=False) project_id = '456' vtype = volume_types.create(self.ctxt, 'type1', projects=['456'], is_public=False) vtype_id = vtype.get('id') volume_types.remove_volume_type_access(self.ctxt, vtype_id, project_id) vtype_access = db.volume_type_access_get_all(self.ctxt.elevated(), vtype_id) self.assertNotIn(project_id, vtype_access)
def _removeProjectAccess(self, req, id, body): context = req.environ['cinder.context'] authorize(context, action="removeProjectAccess") self._check_body(body, 'removeProjectAccess') project = body['removeProjectAccess']['project'] try: volume_types.remove_volume_type_access(context, id, project) except (exception.VolumeTypeNotFound, exception.VolumeTypeAccessNotFound) as err: raise webob.exc.HTTPNotFound(explanation=six.text_type(err)) return webob.Response(status_int=202)