def setUp(self): super(FunctionalTestBase, self).setUp() # NOTE(flaper87): Config can't be a class # attribute because it may be necessary to # modify it at runtime which will affect # other instances running instances. self.cfg = config.load_config() if not self.cfg.run_tests: self.skipTest("Functional tests disabled") self.mconf = self.load_conf(self.cfg.marconi.config) # NOTE(flaper87): Use running instances. if (self.cfg.marconi.run_server and not self.server): self.server = self.server_class() self.server.start(self.mconf) validator = validation.Validator(self.mconf) self.limits = validator._limits_conf # NOTE(flaper87): Create client # for this test unit. self.client = http.Client() self.headers = helpers.create_marconi_headers(self.cfg) if self.cfg.auth.auth_on: auth_token = helpers.get_keystone_token(self.cfg, self.client) self.headers["X-Auth-Token"] = auth_token self.headers_response_with_body = set(['location', 'content-type']) self.client.set_headers(self.headers)
def __init__(self, conf, storage, cache, control): super(Driver, self).__init__(conf, storage, cache, control) self._conf.register_opts(_WSGI_OPTIONS, group=_WSGI_GROUP) self._wsgi_conf = self._conf[_WSGI_GROUP] self._validate = validation.Validator(self._conf) self.app = None self._init_routes() self._init_middleware()
def setUp(self): super(FunctionalTestBase, self).setUp() # NOTE(flaper87): Config can't be a class # attribute because it may be necessary to # modify it at runtime which will affect # other instances running instances. self.cfg = config.load_config() if not self.cfg.run_tests: self.skipTest("Functional tests disabled") self.mconf = self.load_conf(self.cfg.marconi.config) validator = validation.Validator(self.mconf) self.limits = validator._limits_conf self.response = response.ResponseSchema(self.limits) if _TEST_INTEGRATION: # TODO(kgriffs): This code should be replaced to use # an external wsgi server instance. # NOTE(flaper87): Use running instances. if self.cfg.marconi.run_server: if not (self.server and self.server.is_alive()): # pylint: disable=not-callable self.server = self.server_class() self.server.start(self.mconf) self.client = http.Client() else: self.client = http.WSGIClient( bootstrap.Bootstrap(config.cfg.CONF).transport.app) self.headers = helpers.create_marconi_headers(self.cfg) if self.cfg.auth.auth_on: auth_token = helpers.get_keystone_token(self.cfg, self.client) self.headers["X-Auth-Token"] = auth_token self.headers_response_with_body = set(['location', 'content-type']) self.client.set_headers(self.headers)