Ejemplo n.º 1
0
 def test_simple_api_actions(self):
     app = fakes.wsgi_app()
     for _action in self._actions:
         req = webob.Request.blank('/v1/fake/volumes/%s/action' % self.UUID)
         req.method = 'POST'
         req.body = jsonutils.dumps({_action: None})
         req.content_type = 'application/json'
         res = req.get_response(app)
         self.assertEqual(res.status_int, 202)
Ejemplo n.º 2
0
    def test_attach(self):
        body = {'os-attach': {'instance_uuid': 'fake',
                              'mountpoint': '/dev/vdc'}}
        req = webob.Request.blank('/v1/fake/volumes/1/action')
        req.method = "POST"
        req.body = jsonutils.dumps(body)
        req.headers["content-type"] = "application/json"

        res = req.get_response(fakes.wsgi_app())
        self.assertEqual(res.status_int, 202)
Ejemplo n.º 3
0
 def test_simple_api_actions(self):
     app = fakes.wsgi_app()
     for _action in self._actions:
         req = webob.Request.blank('/v1/fake/volumes/%s/action' %
                 self.UUID)
         req.method = 'POST'
         req.body = jsonutils.dumps({_action: None})
         req.content_type = 'application/json'
         res = req.get_response(app)
         self.assertEqual(res.status_int, 202)
Ejemplo n.º 4
0
    def test_terminate_connection(self):
        def fake_terminate_connection(*args, **kwargs):
            return {}
        self.stubs.Set(volume.API, 'terminate_connection',
                       fake_terminate_connection)

        body = {'os-terminate_connection': {'connector': 'fake'}}
        req = webob.Request.blank('/v1/fake/volumes/1/action')
        req.method = "POST"
        req.body = jsonutils.dumps(body)
        req.headers["content-type"] = "application/json"

        res = req.get_response(fakes.wsgi_app())
        self.assertEqual(res.status_int, 202)
Ejemplo n.º 5
0
    def test_attach(self):
        body = {
            'os-attach': {
                'instance_uuid': 'fake',
                'mountpoint': '/dev/vdc'
            }
        }
        req = webob.Request.blank('/v1/fake/volumes/1/action')
        req.method = "POST"
        req.body = jsonutils.dumps(body)
        req.headers["content-type"] = "application/json"

        res = req.get_response(fakes.wsgi_app())
        self.assertEqual(res.status_int, 202)
Ejemplo n.º 6
0
    def test_terminate_connection(self):
        def fake_terminate_connection(*args, **kwargs):
            return {}

        self.stubs.Set(volume.API, 'terminate_connection',
                       fake_terminate_connection)

        body = {'os-terminate_connection': {'connector': 'fake'}}
        req = webob.Request.blank('/v1/fake/volumes/1/action')
        req.method = "POST"
        req.body = jsonutils.dumps(body)
        req.headers["content-type"] = "application/json"

        res = req.get_response(fakes.wsgi_app())
        self.assertEqual(res.status_int, 202)
 def _make_request(self, url):
     req = webob.Request.blank(url)
     req.headers['Accept'] = self.content_type
     res = req.get_response(fakes.wsgi_app())
     return res
 def _make_request(self, url):
     req = webob.Request.blank(url)
     req.headers['Accept'] = self.content_type
     res = req.get_response(fakes.wsgi_app())
     return res