def test_member_force_delete_snapshot(self): snapshot = stubs.stub_snapshot(1, host="foo") self.mock_object(db, "share_get", lambda x, y: snapshot) self.mock_object(db, "share_snapshot_get", lambda x, y: snapshot) self.mock_object(share_api.API, "delete_snapshot", lambda *x, **y: True) path = "/v1/fake/snapshots/%s/action" % snapshot["id"] req = webob.Request.blank(path) req.method = "POST" req.headers["content-type"] = "application/json" req.body = six.b(jsonutils.dumps({"os-force_delete": {}})) req.environ["manila.context"] = self.member_context resp = req.get_response(app()) self.assertEqual(resp.status_int, 403)
def test_member_force_delete_snapshot(self): snapshot = stubs.stub_snapshot(1, host='foo') self.stubs.Set(db, 'share_get', lambda x, y: snapshot) self.stubs.Set(db, 'share_snapshot_get', lambda x, y: snapshot) self.stubs.Set(share_api.API, 'delete_snapshot', lambda *x, **y: True) path = '/v1/fake/snapshots/%s/action' % snapshot['id'] req = webob.Request.blank(path) req.method = 'POST' req.headers['content-type'] = 'application/json' req.body = jsonutils.dumps({'os-force_delete': {}}) req.environ['manila.context'] = self.member_context resp = req.get_response(app()) self.assertEqual(resp.status_int, 403)
def test_member_force_delete_snapshot(self): snapshot = stubs.stub_snapshot(1, host='foo') self.stubs.Set(db, 'share_get', lambda x, y: snapshot) self.stubs.Set(db, 'share_snapshot_get', lambda x, y: snapshot) self.stubs.Set(share_api.API, 'delete_snapshot', lambda *x, **y: True) path = '/v1/fake/snapshots/%s/action' % snapshot['id'] req = webob.Request.blank(path) req.method = 'POST' req.headers['content-type'] = 'application/json' req.body = jsonutils.dumps({'os-force_delete': {}}) req.environ['manila.context'] = self.member_context resp = req.get_response(app()) self.assertEqual(resp.status_int, 403)