def _create_authenticator(self, authenticator, auth_plugin, **auth_args): if authenticator: return authenticator plugin = module_loader.ModuleLoader().get_auth_plugin(auth_plugin) valid_list = plugin.valid_options args = dict((n, auth_args[n]) for n in valid_list if n in auth_args) return plugin(**args)
def test_list_auth_plugins(self): plugins = sorted(module_loader.ModuleLoader().list_auth_plugins()) expected = [ 'password', 'token', 'v2password', 'v2token', 'v3password', 'v3token' ] self.assertEqual(expected, plugins)
def test_list_auth_plugins(self): plugins = sorted(module_loader.ModuleLoader().list_auth_plugins()) expected = [ 'identity', 'identity_v2_password', 'identity_v2_token', 'identity_v3_password', 'identity_v3_token' ] self.assertEqual(expected, plugins)
def test_load_bogus(self): self.assertRaises(exceptions.NoMatchingPlugin, module_loader.ModuleLoader().get_auth_plugin, 'wot')
def test_load_empty(self): plugin = module_loader.ModuleLoader().get_auth_plugin('') self.assertEqual('openstack.auth.identity.discoverable', str(plugin.__module__))
def test_load_identity_v3(self): loader = module_loader.ModuleLoader() plugin = loader.get_auth_plugin('identity_v3_password') self.assertEqual('openstack.auth.identity.v3', str(plugin.__module__)) plugin = loader.get_auth_plugin('identity_v3_token') self.assertEqual('openstack.auth.identity.v3', str(plugin.__module__))