Merge "Add token auth test"

This commit is contained in:
Jenkins 2017-04-20 20:18:16 +00:00 committed by Gerrit Code Review
commit aa31cbb63d
1 changed files with 30 additions and 0 deletions

View File

@ -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()