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.make_app(cfg.CONF, attach_storage=False) self.assertEqual(api_app.wsgi_app.auth_protocol, 'foottp')
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("auth_uri", None, group=acl.OPT_GROUP_NAME) api_app = app.make_app(cfg.CONF, attach_storage=False) self.assertTrue(api_app.wsgi_app.auth_uri.startswith('file'))
def setUp(self): super(TestBase, self).setUp() self.app = v1_app.make_app(enable_acl=False, attach_storage=False) self.app.register_blueprint(v1_blueprint.blueprint) self.test_app = self.app.test_client() @self.app.before_request def attach_storage_connection(): flask.request.storage_conn = self.conn
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.make_app(cfg.CONF, attach_storage=False) self.assertEqual(api_app.wsgi_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("[%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.make_app(cfg.CONF, attach_storage=False) self.assertEqual(api_app.wsgi_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("[%s]\nauth_protocol = file" % acl.OPT_GROUP_NAME) f.write("\nauth_version = v2.0") service.prepare_service(['ceilometer-api', '--config-file=%s' % tmpfile]) api_app = app.make_app(cfg.CONF, attach_storage=False) self.assertTrue(api_app.wsgi_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("auth_uri", None, group=acl.OPT_GROUP_NAME) api_app = app.make_app(self.CONF, attach_storage=False) self.assertTrue(api_app.wsgi_app.auth_uri.startswith('foottp'))
def test_keystone_middleware_parse_conffile(self): content = "[{0}]\nauth_protocol = barttp"\ "\nauth_version = v2.0".format(acl.OPT_GROUP_NAME) tmpfile = fileutils.write_to_tempfile(content=content, prefix='ceilometer', suffix='.conf') service.prepare_service(['ceilometer-api', '--config-file=%s' % tmpfile]) api_app = app.make_app(self.CONF, attach_storage=False) self.assertTrue(api_app.wsgi_app.auth_uri.startswith('barttp')) os.unlink(tmpfile)
def test_keystone_middleware_parse_conffile(self): content = "[{0}]\nauth_protocol = barttp"\ "\nauth_version = v2.0".format(acl.OPT_GROUP_NAME) tmpfile = fileutils.write_to_tempfile(content=content, prefix='ceilometer', suffix='.conf') service.prepare_service( ['ceilometer-api', '--config-file=%s' % tmpfile]) api_app = app.make_app(self.CONF, attach_storage=False) self.assertTrue(api_app.wsgi_app.auth_uri.startswith('barttp')) os.unlink(tmpfile)
def setUp(self): super(TestBase, self).setUp() cfg.CONF.set_override("auth_version", "v2.0", group=acl.OPT_GROUP_NAME) self.app = v1_app.make_app(cfg.CONF, enable_acl=False, attach_storage=False) self.app.register_blueprint(v1_blueprint.blueprint) self.test_app = self.app.test_client() @self.app.before_request def attach_storage_connection(): flask.request.storage_conn = self.conn
def __init__(self): pc = get_pecan_config() pc.app.enable_acl = (CONF.auth_strategy == 'keystone') if cfg.CONF.enable_v1_api: from ceilometer.api.v1 import app as v1app self.v1 = v1app.make_app(cfg.CONF, enable_acl=pc.app.enable_acl) else: def not_found(environ, start_response): start_response('404 Not Found', []) return [] self.v1 = not_found self.v2 = setup_app(pecan_config=pc)
def test_keystone_middleware_conf(self): self.CONF.set_override("auth_protocol", "file", group=acl.OPT_GROUP_NAME) self.CONF.set_override("auth_version", "v2.0", group=acl.OPT_GROUP_NAME) self.CONF.set_override("auth_uri", None, group=acl.OPT_GROUP_NAME) api_app = app.make_app(self.CONF, attach_storage=False) conf = dict(self.CONF.get(acl.OPT_GROUP_NAME)) api_app = auth_token.AuthProtocol(api_app, conf=conf) self.assertTrue(api_app.auth_uri.startswith('file'))
def __init__(self): pc = get_pecan_config() pc.app.debug = CONF.debug if cfg.CONF.enable_v1_api: from ceilometer.api.v1 import app as v1app self.v1 = v1app.make_app(cfg.CONF) else: def not_found(environ, start_response): start_response('404 Not Found', []) return [] self.v1 = not_found self.v2 = setup_app(pecan_config=pc)
def setUp(self): super(TestBase, self).setUp() service.prepare_service([]) cfg.CONF.set_override("auth_version", "v2.0", group=acl.OPT_GROUP_NAME) cfg.CONF.set_override("policy_file", self.path_get('tests/policy.json')) sources_file = self.path_get('tests/sources.json') self.app = v1_app.make_app(cfg.CONF, enable_acl=False, attach_storage=False, sources_file=sources_file) self.app.register_blueprint(v1_blueprint.blueprint) self.test_app = self.app.test_client() @self.app.before_request def attach_storage_connection(): flask.request.storage_conn = self.conn
def setUp(self): super(TestBase, self).setUp() service.prepare_service([]) self.CONF.set_override("auth_version", "v2.0", group=acl.OPT_GROUP_NAME) self.CONF.set_override("policy_file", self.path_get('etc/ceilometer/policy.json')) sources_file = self.path_get('ceilometer/tests/sources.json') self.app = v1_app.make_app(self.CONF, enable_acl=False, attach_storage=False, sources_file=sources_file) # this is needed to pass over unhandled exceptions self.app.debug = True self.app.register_blueprint(v1_blueprint.blueprint) self.test_app = self.app.test_client() @self.app.before_request def attach_storage_connection(): flask.request.storage_conn = self.conn
def __init__(self): pc = get_pecan_config() pc.app.debug = CONF.debug pc.app.enable_acl = (CONF.auth_strategy == 'keystone') self.v1 = v1app.make_app(cfg.CONF, enable_acl=pc.app.enable_acl) self.v2 = setup_app(pecan_config=pc)
def test_keystone_middleware_conf(self): cfg.CONF.set_override("auth_protocol", "foottp", group=acl.OPT_GROUP_NAME) api_app = app.make_app(cfg.CONF, attach_storage=False) self.assertEqual(api_app.wsgi_app.auth_protocol, 'foottp')
def __init__(self): pc = get_pecan_config() pc.app.debug = CONF.debug pc.app.enable_acl = CONF.auth_strategy == "keystone" self.v1 = v1app.make_app(cfg.CONF, enable_acl=pc.app.enable_acl) self.v2 = setup_app(pecan_config=pc)