예제 #1
0
        def getresponse(self):
            conf = utils.TestConfigOpts({
                'verbose':
                VERBOSE,
                'debug':
                DEBUG,
                'bind_host':
                '0.0.0.0',
                'bind_port':
                '9999999',
                'registry_host':
                '0.0.0.0',
                'registry_port':
                '9191',
                'default_store':
                'file',
                'filesystem_store_datadir':
                base_dir,
                'policy_file':
                os.path.join(base_dir, 'policy.json'),
            })
            api = version_negotiation.VersionNegotiationFilter(
                context.ContextMiddleware(router.API(conf), 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
예제 #2
0
        def getresponse(self):
            sql_connection = os.environ.get('GLANCE_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
예제 #3
0
        def getresponse(self):
            sql_connection = kwargs.get('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
예제 #4
0
        def getresponse(self):
            options = {'verbose': VERBOSE,
                       'debug': DEBUG,
                       'bind_host': '0.0.0.0',
                       'bind_port': '9999999',
                       'registry_host': '0.0.0.0',
                       'registry_port': '9191',
                       'default_store': 'file',
                       'filesystem_store_datadir': FAKE_FILESYSTEM_ROOTDIR}
            api = version_negotiation.VersionNegotiationFilter(
                context.ContextMiddleware(server.API(options), 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 _build_middleware(self):
     return context.ContextMiddleware(None)