From f079b5b9c4c030293b4ebfdf84d8b768b3aa3515 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Wed, 22 Oct 2014 11:12:47 -0500 Subject: Change --os-auth-plugin to --os-auth-type User's don't know what a plugin is. * Internally, os_auth_type and/or auth_type represents what the user supplied. * auth_plugin_name is the name of the selected plugin * auth_plugin is the actual plugin object Plugin selection process: * if --os-auth-type is supplied: * if it matches against an available plugin, done * (if it can map to an availble plugin type, done; TODO in a followup) * if --os-auth-type is not supplied: * if --os-url and --os-token are supplied, select 'token_endpoint' * if --os-username supplied, select identity_api_version + 'password' * if --os-token supplied, select identity_api_version + 'token' Change-Id: Ice4535214e311ebf924087cf77f6d84d76f5f3ee --- openstackclient/tests/common/test_clientmanager.py | 16 +++++----- openstackclient/tests/test_shell.py | 36 +++++++++++----------- 2 files changed, 26 insertions(+), 26 deletions(-) (limited to 'openstackclient/tests') diff --git a/openstackclient/tests/common/test_clientmanager.py b/openstackclient/tests/common/test_clientmanager.py index a7b13c6c..8c27e562 100644 --- a/openstackclient/tests/common/test_clientmanager.py +++ b/openstackclient/tests/common/test_clientmanager.py @@ -44,7 +44,7 @@ class FakeOptions(object): def __init__(self, **kwargs): for option in auth.OPTIONS_LIST: setattr(self, 'os_' + option.replace('-', '_'), None) - self.os_auth_plugin = None + self.os_auth_type = None self.os_identity_api_version = '2.0' self.timing = None self.os_region_name = None @@ -81,7 +81,7 @@ class TestClientManager(utils.TestCase): client_manager = clientmanager.ClientManager( auth_options=FakeOptions(os_token=fakes.AUTH_TOKEN, os_url=fakes.AUTH_URL, - os_auth_plugin='token_endpoint'), + os_auth_type='token_endpoint'), api_version=API_VERSION, verify=True ) @@ -105,7 +105,7 @@ class TestClientManager(utils.TestCase): client_manager = clientmanager.ClientManager( auth_options=FakeOptions(os_token=fakes.AUTH_TOKEN, os_auth_url=fakes.AUTH_URL, - os_auth_plugin='v2token'), + os_auth_type='v2token'), api_version=API_VERSION, verify=True ) @@ -183,7 +183,7 @@ class TestClientManager(utils.TestCase): auth_options=FakeOptions(os_auth_url=fakes.AUTH_URL, os_username=fakes.USERNAME, os_password=fakes.PASSWORD, - os_auth_plugin='v2password'), + os_auth_type='v2password'), api_version=API_VERSION, verify='cafile', ) @@ -192,8 +192,8 @@ class TestClientManager(utils.TestCase): self.assertTrue(client_manager._verify) self.assertEqual('cafile', client_manager._cacert) - def _select_auth_plugin(self, auth_params, api_version, auth_plugin): - auth_params['os_auth_plugin'] = auth_plugin + def _select_auth_plugin(self, auth_params, api_version, auth_plugin_name): + auth_params['os_auth_type'] = auth_plugin_name auth_params['os_identity_api_version'] = api_version client_manager = clientmanager.ClientManager( auth_options=FakeOptions(**auth_params), @@ -201,8 +201,8 @@ class TestClientManager(utils.TestCase): verify=True ) self.assertEqual( - auth_plugin, - client_manager._auth_plugin, + auth_plugin_name, + client_manager.auth_plugin_name, ) def test_client_manager_select_auth_plugin(self): diff --git a/openstackclient/tests/test_shell.py b/openstackclient/tests/test_shell.py index b0c1452e..837a48af 100644 --- a/openstackclient/tests/test_shell.py +++ b/openstackclient/tests/test_shell.py @@ -108,8 +108,8 @@ class TestShell(utils.TestCase): default_args["region_name"]) self.assertEqual(_shell.options.os_trust_id, default_args["trust_id"]) - self.assertEqual(_shell.options.os_auth_plugin, - default_args['auth_plugin']) + self.assertEqual(_shell.options.os_auth_type, + default_args['auth_type']) def _assert_token_auth(self, cmd_options, default_args): with mock.patch("openstackclient.shell.OpenStackShell.initialize_app", @@ -190,7 +190,7 @@ class TestShellPasswordAuth(TestShell): "password": "", "region_name": "", "trust_id": "", - "auth_plugin": "", + "auth_type": "", } self._assert_password_auth(flag, kwargs) @@ -210,7 +210,7 @@ class TestShellPasswordAuth(TestShell): "password": "", "region_name": "", "trust_id": "", - "auth_plugin": "", + "auth_type": "", } self._assert_password_auth(flag, kwargs) @@ -230,7 +230,7 @@ class TestShellPasswordAuth(TestShell): "password": "", "region_name": "", "trust_id": "", - "auth_plugin": "", + "auth_type": "", } self._assert_password_auth(flag, kwargs) @@ -250,7 +250,7 @@ class TestShellPasswordAuth(TestShell): "password": "", "region_name": "", "trust_id": "", - "auth_plugin": "", + "auth_type": "", } self._assert_password_auth(flag, kwargs) @@ -270,7 +270,7 @@ class TestShellPasswordAuth(TestShell): "password": "", "region_name": "", "trust_id": "", - "auth_plugin": "", + "auth_type": "", } self._assert_password_auth(flag, kwargs) @@ -290,7 +290,7 @@ class TestShellPasswordAuth(TestShell): "password": "", "region_name": "", "trust_id": "", - "auth_plugin": "", + "auth_type": "", } self._assert_password_auth(flag, kwargs) @@ -310,7 +310,7 @@ class TestShellPasswordAuth(TestShell): "password": "", "region_name": "", "trust_id": "", - "auth_plugin": "", + "auth_type": "", } self._assert_password_auth(flag, kwargs) @@ -330,7 +330,7 @@ class TestShellPasswordAuth(TestShell): "password": "", "region_name": "", "trust_id": "", - "auth_plugin": "", + "auth_type": "", } self._assert_password_auth(flag, kwargs) @@ -350,7 +350,7 @@ class TestShellPasswordAuth(TestShell): "password": "", "region_name": "", "trust_id": "", - "auth_plugin": "", + "auth_type": "", } self._assert_password_auth(flag, kwargs) @@ -370,7 +370,7 @@ class TestShellPasswordAuth(TestShell): "password": "", "region_name": "", "trust_id": "", - "auth_plugin": "", + "auth_type": "", } self._assert_password_auth(flag, kwargs) @@ -390,7 +390,7 @@ class TestShellPasswordAuth(TestShell): "password": DEFAULT_PASSWORD, "region_name": "", "trust_id": "", - "auth_plugin": "", + "auth_type": "", } self._assert_password_auth(flag, kwargs) @@ -410,7 +410,7 @@ class TestShellPasswordAuth(TestShell): "password": "", "region_name": DEFAULT_REGION_NAME, "trust_id": "", - "auth_plugin": "", + "auth_type": "", } self._assert_password_auth(flag, kwargs) @@ -430,12 +430,12 @@ class TestShellPasswordAuth(TestShell): "password": "", "region_name": "", "trust_id": "1234", - "auth_plugin": "", + "auth_type": "", } self._assert_password_auth(flag, kwargs) - def test_only_auth_plugin_flow(self): - flag = "--os-auth-plugin " + "v2password" + def test_only_auth_type_flow(self): + flag = "--os-auth-type " + "v2password" kwargs = { "auth_url": "", "project_id": "", @@ -450,7 +450,7 @@ class TestShellPasswordAuth(TestShell): "password": "", "region_name": "", "trust_id": "", - "auth_plugin": DEFAULT_AUTH_PLUGIN + "auth_type": DEFAULT_AUTH_PLUGIN } self._assert_password_auth(flag, kwargs) -- cgit v1.2.1