Merge "Fix config error"

This commit is contained in:
Jenkins
2016-03-28 23:29:25 +00:00
committed by Gerrit Code Review
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"