Пример #1
0
    def getresponse(self):
        mapper = routes.Mapper()
        api = context.UnauthenticatedContextMiddleware(rserver.API(mapper))
        webob_res = self.req.get_response(api)

        return utils.FakeHTTPResponse(status=webob_res.status_int,
                                      headers=webob_res.headers,
                                      data=webob_res.body)
Пример #2
0
        def getresponse(self):
            sql_connection = kwargs.get('sql_connection', "sqlite:///")
            api = context.UnauthenticatedContextMiddleware(
                rserver.API(conf), conf)
            res = self.req.get_response(api)

            # httplib.Response has a read() method...fake it out
            def fake_reader():
                return res.body

            setattr(res, 'read', fake_reader)
            return res
Пример #3
0
    def getresponse(self):
        mapper = routes.Mapper()
        server = rserver.API(mapper)
        # NOTE(markwash): we need to pass through context auth information if
        # we have it.
        if 'X-Auth-Token' in self.req.headers:
            api = utils.FakeAuthMiddleware(server)
        else:
            api = context.UnauthenticatedContextMiddleware(server)
        webob_res = self.req.get_response(api)

        return utils.FakeHTTPResponse(status=webob_res.status_int,
                                      headers=webob_res.headers,
                                      data=webob_res.body)
Пример #4
0
        def getresponse(self):
            sql_connection = kwargs.get('sql_connection', "sqlite:///")
            context_class = 'glance.registry.context.RequestContext'
            options = {
                'sql_connection': sql_connection,
                'verbose': VERBOSE,
                'debug': DEBUG,
                'context_class': context_class
            }
            api = context.ContextMiddleware(rserver.API(options), options)
            res = self.req.get_response(api)

            # httplib.Response has a read() method...fake it out
            def fake_reader():
                return res.body

            setattr(res, 'read', fake_reader)
            return res
Пример #5
0
        def getresponse(self):
            sql_connection = os.environ.get('GLANCE_SQL_CONNECTION',
                                            "sqlite://")
            context_class = 'glance.registry.context.RequestContext'
            conf = utils.TestConfigOpts({
                'sql_connection': sql_connection,
                'verbose': VERBOSE,
                'debug': DEBUG
            })
            api = context.ContextMiddleware(rserver.API(conf),
                                            conf,
                                            context_class=context_class)
            res = self.req.get_response(api)

            # httplib.Response has a read() method...fake it out
            def fake_reader():
                return res.body

            setattr(res, 'read', fake_reader)
            return res