Fix config error

Replace cfg.CONF.api_paste_ini to cfg.CONF.api.api_paste_ini

Change-Id: Ibf61fb37f1dae877bbeab3dfcb005be52187fe1a
Closes-Bug: #1562725
This commit is contained in:
Aaron-DH 2016-03-25 20:15:22 +08:00 committed by Aaron Ding
parent 0e71ed8272
commit ce55b7619f
2 changed files with 8 additions and 1 deletions

View File

@ -80,7 +80,7 @@ def load_app():
cfg_file = cfg_path
if not cfg_file:
raise cfg.ConfigFilesNotFoundError([cfg.CONF.api_paste_config])
raise cfg.ConfigFilesNotFoundError([cfg.CONF.api.api_paste_config])
LOG.info(_("Full WSGI config used: %s") % cfg_file)
return deploy.loadapp("config:" + cfg_file)

View File

@ -102,6 +102,13 @@ class TestRootController(api_base.FunctionalTest):
response = self.app.get('/a/bogus/url', expect_errors=True)
assert response.status_int == 404
def test_api_paste_file_not_exist(self):
cfg.CONF.set_override('api_paste_config', 'non-existent-file',
group='api')
with mock.patch.object(cfg.CONF, 'find_file') as ff:
ff.return_value = None
self.assertRaises(cfg.ConfigFilesNotFoundError, app.load_app)
def test_noauth(self):
# Don't need to auth
paste_file = "magnum/tests/unit/api/controllers/noauth-paste.ini"