summaryrefslogtreecommitdiff
path: root/openstackclient/tests
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2019-08-29 00:02:31 +0000
committerGerrit Code Review <review@openstack.org>2019-08-29 00:02:31 +0000
commiteed615e7d0fb0935ddde0565bf93174549f2456a (patch)
treefd7976111e68e341b3425032a432a91cdf1768d4 /openstackclient/tests
parentfd63a909a8247775d474521007546785566af13a (diff)
parent6fcc2608b17d84cf3699bb4a5bae692404393ca1 (diff)
downloadpython-openstackclient-eed615e7d0fb0935ddde0565bf93174549f2456a.tar.gz
Merge "Remove token_endpoint auth type"
Diffstat (limited to 'openstackclient/tests')
-rw-r--r--openstackclient/tests/functional/common/test_args.py26
-rw-r--r--openstackclient/tests/unit/common/test_clientmanager.py8
-rw-r--r--openstackclient/tests/unit/test_shell.py22
3 files changed, 28 insertions, 28 deletions
diff --git a/openstackclient/tests/functional/common/test_args.py b/openstackclient/tests/functional/common/test_args.py
index dd1fd0fb..02cad6c1 100644
--- a/openstackclient/tests/functional/common/test_args.py
+++ b/openstackclient/tests/functional/common/test_args.py
@@ -12,6 +12,8 @@
import json
+from tempest.lib import exceptions as tempest_exc
+
from openstackclient.tests.functional import base
@@ -49,19 +51,17 @@ class ArgumentTests(base.TestCase):
)
def test_auth_type_token_endpoint_opt(self):
- cmd_output = json.loads(self.openstack(
- 'configuration show -f json --os-auth-type token_endpoint',
- cloud=None,
- ))
- self.assertIsNotNone(cmd_output)
- self.assertIn(
- 'auth_type',
- cmd_output.keys(),
- )
- self.assertEqual(
- 'token_endpoint',
- cmd_output['auth_type'],
- )
+ # Make sure token_endpoint is really gone
+ try:
+ self.openstack(
+ 'configuration show -f json --os-auth-type token_endpoint',
+ cloud=None,
+ )
+ except tempest_exc.CommandFailed as e:
+ self.assertIn('--os-auth-type: invalid choice:', str(e))
+ self.assertIn('token_endpoint', str(e))
+ else:
+ self.fail('CommandFailed should be raised')
def test_auth_type_password_opt(self):
cmd_output = json.loads(self.openstack(
diff --git a/openstackclient/tests/unit/common/test_clientmanager.py b/openstackclient/tests/unit/common/test_clientmanager.py
index f15f9af1..a83b1318 100644
--- a/openstackclient/tests/unit/common/test_clientmanager.py
+++ b/openstackclient/tests/unit/common/test_clientmanager.py
@@ -28,19 +28,19 @@ class TestClientManager(osc_lib_test_utils.TestClientManager):
"""Allow subclasses to override the ClientManager class"""
return clientmanager.ClientManager
- def test_client_manager_token_endpoint(self):
+ def test_client_manager_admin_token(self):
token_auth = {
- 'url': fakes.AUTH_URL,
+ 'endpoint': fakes.AUTH_URL,
'token': fakes.AUTH_TOKEN,
}
client_manager = self._make_clientmanager(
auth_args=token_auth,
- auth_plugin_name='token_endpoint',
+ auth_plugin_name='admin_token',
)
self.assertEqual(
fakes.AUTH_URL,
- client_manager._cli_options.config['auth']['url'],
+ client_manager._cli_options.config['auth']['endpoint'],
)
self.assertEqual(
fakes.AUTH_TOKEN,
diff --git a/openstackclient/tests/unit/test_shell.py b/openstackclient/tests/unit/test_shell.py
index 5d413e7e..31675c47 100644
--- a/openstackclient/tests/unit/test_shell.py
+++ b/openstackclient/tests/unit/test_shell.py
@@ -153,7 +153,7 @@ class TestShell(osc_lib_test_utils.TestShell):
# released in osc-lib
self.shell_class = importutils.import_class(self.shell_class_name)
- def _assert_token_endpoint_auth(self, cmd_options, default_args):
+ def _assert_admin_token_auth(self, cmd_options, default_args):
with mock.patch(
self.shell_class_name + ".initialize_app",
self.app,
@@ -172,9 +172,9 @@ class TestShell(osc_lib_test_utils.TestShell):
"token",
)
self.assertEqual(
- default_args.get("url", ''),
- _shell.options.url,
- "url",
+ default_args.get("endpoint", ''),
+ _shell.options.endpoint,
+ "endpoint",
)
def _assert_token_auth(self, cmd_options, default_args):
@@ -338,7 +338,7 @@ class TestShellTokenEndpointAuthEnv(TestShell):
super(TestShellTokenEndpointAuthEnv, self).setUp()
env = {
"OS_TOKEN": DEFAULT_TOKEN,
- "OS_URL": DEFAULT_SERVICE_URL,
+ "OS_ENDPOINT": DEFAULT_SERVICE_URL,
}
self.useFixture(osc_lib_test_utils.EnvFixture(env.copy()))
@@ -346,23 +346,23 @@ class TestShellTokenEndpointAuthEnv(TestShell):
flag = ""
kwargs = {
"token": DEFAULT_TOKEN,
- "url": DEFAULT_SERVICE_URL,
+ "endpoint": DEFAULT_SERVICE_URL,
}
- self._assert_token_endpoint_auth(flag, kwargs)
+ self._assert_admin_token_auth(flag, kwargs)
def test_only_token(self):
flag = "--os-token xyzpdq"
kwargs = {
"token": "xyzpdq",
- "url": DEFAULT_SERVICE_URL,
+ "endpoint": DEFAULT_SERVICE_URL,
}
self._assert_token_auth(flag, kwargs)
def test_only_url(self):
- flag = "--os-url http://cloud.local:555"
+ flag = "--os-endpoint http://cloud.local:555"
kwargs = {
"token": DEFAULT_TOKEN,
- "url": "http://cloud.local:555",
+ "endpoint": "http://cloud.local:555",
}
self._assert_token_auth(flag, kwargs)
@@ -371,7 +371,7 @@ class TestShellTokenEndpointAuthEnv(TestShell):
flag = ""
kwargs = {
"token": '',
- "url": '',
+ "endpoint": '',
}
self._assert_token_auth(flag, kwargs)