Merge "Fix NoSuchOptError when referring to conf.neutron.auth_plugin"

This commit is contained in:
Jenkins 2016-05-01 05:35:17 +00:00 committed by Gerrit Code Review
commit 9a2a629cda
2 changed files with 8 additions and 1 deletions

View File

@ -104,7 +104,7 @@ def _load_auth_plugin(conf):
if auth_plugin:
return auth_plugin
err_msg = _('Unknown auth plugin: %s') % conf.neutron.auth_plugin
err_msg = _('Unknown auth type: %s') % conf.neutron.auth_type
raise neutron_client_exc.Unauthorized(message=err_msg)

View File

@ -181,6 +181,13 @@ class TestNeutronClient(test.NoDBTestCase):
client1.list_networks(retrieve_all=False)
self.assertEqual('new_token2', client1.httpclient.auth.get_token(None))
@mock.patch.object(ks_loading, 'load_auth_from_conf_options')
def test_load_auth_plugin_failed(self, mock_load_from_conf):
mock_load_from_conf.return_value = None
from neutronclient.common import exceptions as neutron_client_exc
self.assertRaises(neutron_client_exc.Unauthorized,
neutronapi._load_auth_plugin, CONF)
class TestNeutronv2Base(test.TestCase):