diff --git a/osc_lib/tests/test_clientmanager.py b/osc_lib/tests/test_clientmanager.py index 7ebe1a6..22789fe 100644 --- a/osc_lib/tests/test_clientmanager.py +++ b/osc_lib/tests/test_clientmanager.py @@ -21,6 +21,7 @@ from keystoneauth1 import exceptions as ksa_exceptions from keystoneauth1.identity import generic as generic_plugin from keystoneauth1.identity.v3 import k2k from keystoneauth1 import loading +from keystoneauth1 import token_endpoint from os_client_config import cloud_config from osc_lib.api import auth @@ -71,6 +72,35 @@ class TestClientCache(utils.TestCase): class TestClientManager(utils.TestClientManager): + def test_client_manager_admin_token(self): + token_auth = { + 'endpoint': fakes.AUTH_URL, + 'token': fakes.AUTH_TOKEN, + } + client_manager = self._make_clientmanager( + auth_args=token_auth, + auth_plugin_name='admin_token', + ) + + self.assertEqual( + fakes.AUTH_URL, + client_manager._cli_options.config['auth']['endpoint'], + ) + self.assertEqual( + fakes.AUTH_TOKEN, + client_manager.auth.get_token(None), + ) + self.assertIsInstance( + client_manager.auth, + token_endpoint.Token, + ) + # NOTE(dtroyer): This is intentionally not assertFalse() as the return + # value from is_service_available() may be == None + self.assertNotEqual( + False, + client_manager.is_service_available('network'), + ) + def test_client_manager_password(self): client_manager = self._make_clientmanager()