Add token auth test
Add a ClientManager test for Token authentication (specifically keystoneauth's admin_token) that got dropped in the move from OSC because OSC uses its own token_endpoint plugin loader, but creates the same AdminToken object. This would have prevented the issues seen with the merging of https://review.openstack.org/452711 that were subsequently reverted in https://review.openstack.org/458586. Change-Id: I516682057d759d4becd8f6675cf7fa262d224eb9
This commit is contained in:
parent
aec3f4a831
commit
897e623252
|
@ -21,6 +21,7 @@ from keystoneauth1 import exceptions as ksa_exceptions
|
||||||
from keystoneauth1.identity import generic as generic_plugin
|
from keystoneauth1.identity import generic as generic_plugin
|
||||||
from keystoneauth1.identity.v3 import k2k
|
from keystoneauth1.identity.v3 import k2k
|
||||||
from keystoneauth1 import loading
|
from keystoneauth1 import loading
|
||||||
|
from keystoneauth1 import token_endpoint
|
||||||
from os_client_config import cloud_config
|
from os_client_config import cloud_config
|
||||||
|
|
||||||
from osc_lib.api import auth
|
from osc_lib.api import auth
|
||||||
|
@ -71,6 +72,35 @@ class TestClientCache(utils.TestCase):
|
||||||
|
|
||||||
class TestClientManager(utils.TestClientManager):
|
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):
|
def test_client_manager_password(self):
|
||||||
client_manager = self._make_clientmanager()
|
client_manager = self._make_clientmanager()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue