Exemple #1
0
    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")

        # NOTE(flaper87): Use running instances.
        if (self.cfg.marconi.run_server and not
                self.server):
            self.server = self.server_class()
            self.server.start(self.conf_path(self.cfg.marconi.config))

        self.mconf = self.load_conf(self.cfg.marconi.config).conf
        self.limits = self.mconf['limits:transport']

        # NOTE(flaper87): Create client
        # for this test unit.
        self.client = http.Client()
        self.header = helpers.create_marconi_headers(self.cfg)

        if self.cfg.auth.auth_on:
            auth_token = helpers.get_keystone_token(self.cfg, self.client)
            self.header["X-Auth-Token"] = auth_token

        self.headers_response_with_body = set(['location',
                                               'content-type'])

        self.client.set_headers(self.header)
Exemple #2
0
    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)
Exemple #3
0
    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)
Exemple #4
0
    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)