def _check_pecan_debug(g_debug, p_debug, expected): self.CONF.set_override('debug', g_debug) if p_debug is not None: self.CONF.set_override('pecan_debug', p_debug, group='api') app.setup_app() args, kwargs = mocked.call_args self.assertEqual(expected, kwargs.get('debug'))
def test_keystone_middleware_conf(self): cfg.CONF.set_override("auth_protocol", "foottp", group=acl.OPT_GROUP_NAME) cfg.CONF.set_override("auth_version", "v2.0", group=acl.OPT_GROUP_NAME) api_app = app.setup_app() self.assertEqual(api_app.auth_protocol, 'foottp')
def test_keystone_middleware_conf(self): cfg.CONF.set_override("auth_protocol", "foottp", group=acl.OPT_GROUP_NAME) cfg.CONF.set_override("auth_version", "v2.0", group=acl.OPT_GROUP_NAME) cfg.CONF.set_override("pipeline_cfg_file", self.path_get("etc/ceilometer/pipeline.yaml")) api_app = app.setup_app() self.assertEqual(api_app.auth_protocol, 'foottp')
def test_keystone_middleware_parse_conffile(self): tmpfile = tempfile.mktemp() with open(tmpfile, "w") as f: f.write("[%s]\nauth_protocol = barttp" % acl.OPT_GROUP_NAME) service.prepare_service(['ceilometer-api', '--config-file=%s' % tmpfile]) api_app = app.setup_app() self.assertEqual(api_app.auth_protocol, 'barttp') os.unlink(tmpfile)
def test_keystone_middleware_conf(self): cfg.CONF.set_override("auth_protocol", "file", group=acl.OPT_GROUP_NAME) cfg.CONF.set_override("auth_version", "v2.0", group=acl.OPT_GROUP_NAME) cfg.CONF.set_override("pipeline_cfg_file", self.path_get("etc/ceilometer/pipeline.yaml")) cfg.CONF.set_override("connection", "log://", group="database") cfg.CONF.set_override("auth_uri", None, group=acl.OPT_GROUP_NAME) api_app = app.setup_app() self.assertTrue(api_app.auth_uri.startswith("file"))
def test_keystone_middleware_parse_conffile(self): tmpfile = tempfile.mktemp() with open(tmpfile, "w") as f: f.write("[%s]\nauth_protocol = barttp" % acl.OPT_GROUP_NAME) f.write("\nauth_version = v2.0") service.prepare_service( ['ceilometer-api', '--config-file=%s' % tmpfile]) api_app = app.setup_app() self.assertEqual(api_app.auth_protocol, 'barttp') os.unlink(tmpfile)
def test_keystone_middleware_parse_conffile(self): tmpfile = self.temp_config_file_path() with open(tmpfile, "w") as f: f.write("[DEFAULT]\n") f.write("pipeline_cfg_file = %s\n" % self.path_get("etc/ceilometer/pipeline.yaml")) f.write("[%s]\n" % acl.OPT_GROUP_NAME) f.write("auth_protocol = file\n") f.write("auth_version = v2.0\n") service.prepare_service(["ceilometer-api", "--config-file=%s" % tmpfile]) cfg.CONF.set_override("connection", "log://", group="database") api_app = app.setup_app() self.assertTrue(api_app.auth_uri.startswith("file")) os.unlink(tmpfile)
def test_keystone_middleware_conf(self): self.CONF.set_override("auth_protocol", "foottp", group=acl.OPT_GROUP_NAME) self.CONF.set_override("auth_version", "v2.0", group=acl.OPT_GROUP_NAME) self.CONF.set_override("pipeline_cfg_file", self.path_get("etc/ceilometer/pipeline.yaml")) self.CONF.set_override('connection', "log://", group="database") self.CONF.set_override("auth_uri", None, group=acl.OPT_GROUP_NAME) api_app = app.setup_app() self.assertTrue(api_app.auth_uri.startswith('foottp'))
def test_keystone_middleware_parse_conffile(self): tmpfile = self.temp_config_file_path() with open(tmpfile, "w") as f: f.write("[DEFAULT]\n") f.write("pipeline_cfg_file = %s\n" % self.path_get("etc/ceilometer/pipeline.yaml")) f.write("[%s]\n" % acl.OPT_GROUP_NAME) f.write("auth_protocol = barttp\n") f.write("auth_version = v2.0\n") service.prepare_service(['ceilometer-api', '--config-file=%s' % tmpfile]) api_app = app.setup_app() self.assertEqual(api_app.auth_protocol, 'barttp') os.unlink(tmpfile)
def test_keystone_middleware_parse_conffile(self): tmpfile = self.temp_config_file_path() with open(tmpfile, "w") as f: f.write("[DEFAULT]\n") f.write("pipeline_cfg_file = %s\n" % self.path_get("etc/ceilometer/pipeline.yaml")) f.write("[%s]\n" % acl.OPT_GROUP_NAME) f.write("auth_protocol = barttp\n") f.write("auth_version = v2.0\n") service.prepare_service( ['ceilometer-api', '--config-file=%s' % tmpfile]) api_app = app.setup_app() self.assertEqual(api_app.auth_protocol, 'barttp') os.unlink(tmpfile)
def test_keystone_middleware_parse_conffile(self): pipeline_conf = self.path_get("etc/ceilometer/pipeline.yaml") content = "[DEFAULT]\n"\ "pipeline_cfg_file = {0}\n"\ "[{1}]\n"\ "auth_protocol = barttp\n"\ "auth_version = v2.0\n".format(pipeline_conf, acl.OPT_GROUP_NAME) tmpfile = fileutils.write_to_tempfile(content=content, prefix='ceilometer', suffix='.conf') service.prepare_service(['ceilometer-api', '--config-file=%s' % tmpfile]) self.CONF.set_override('connection', "log://", group="database") api_app = app.setup_app() self.assertTrue(api_app.auth_uri.startswith('barttp')) os.unlink(tmpfile)
def test_keystone_middleware_parse_conffile(self): pipeline_conf = self.path_get("etc/ceilometer/pipeline.yaml") content = "[DEFAULT]\n"\ "pipeline_cfg_file = {0}\n"\ "[{1}]\n"\ "auth_protocol = barttp\n"\ "auth_version = v2.0\n".format(pipeline_conf, acl.OPT_GROUP_NAME) tmpfile = fileutils.write_to_tempfile(content=content, prefix='ceilometer', suffix='.conf') service.prepare_service( ['ceilometer-api', '--config-file=%s' % tmpfile]) self.CONF.set_override('connection', "log://", group="database") api_app = app.setup_app() self.assertTrue(api_app.auth_uri.startswith('barttp')) os.unlink(tmpfile)