From 22de9c2bbfbbdea9adbfa29c1a056e11fe947e25 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Tue, 13 Mar 2018 19:18:25 -0500 Subject: [PATCH] Set defaults in ClientManager tests SDK requires the default config values be present in the config dict, add them in the tests that have unique ClientManager creation. Change-Id: I48dd3762377dd8b17ce039acba8c61116c798734 --- osc_lib/tests/test_clientmanager.py | 34 +++++++++++++++++------------ 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/osc_lib/tests/test_clientmanager.py b/osc_lib/tests/test_clientmanager.py index 3df0eac..152e579 100644 --- a/osc_lib/tests/test_clientmanager.py +++ b/osc_lib/tests/test_clientmanager.py @@ -25,9 +25,11 @@ from keystoneauth1 import token_endpoint try: from openstack.config import cloud_config + from openstack.config import defaults _occ_in_sdk = True except ImportError: from os_client_config import cloud_config + from os_client_config import defaults _occ_in_sdk = False from openstack import connection @@ -312,16 +314,18 @@ class TestClientManager(utils.TestClientManager): def test_client_manager_auth_setup_once(self, check_authn_options_func): loader = loading.get_plugin_loader('password') auth_plugin = loader.load_from_options(**AUTH_DICT) + cli_options = defaults.get_defaults() + cli_options.update({ + 'auth_type': 'password', + 'auth': AUTH_DICT, + 'interface': fakes.INTERFACE, + 'region_name': fakes.REGION_NAME, + }) client_manager = self._clientmanager_class()( cli_options=cloud_config.CloudConfig( name='t1', region='1', - config=dict( - auth_type='password', - auth=AUTH_DICT, - interface=fakes.INTERFACE, - region_name=fakes.REGION_NAME, - ), + config=cli_options, auth_plugin=auth_plugin, ), api_version={ @@ -357,18 +361,20 @@ class TestClientManager(utils.TestClientManager): def test_client_manager_k2k_auth_setup(self): loader = loading.get_plugin_loader('password') auth_plugin = loader.load_from_options(**AUTH_DICT) + cli_options = defaults.get_defaults() + cli_options.update({ + 'auth_type': 'password', + 'auth': AUTH_DICT, + 'interface': fakes.INTERFACE, + 'region_name': fakes.REGION_NAME, + 'service_provider': fakes.SERVICE_PROVIDER_ID, + 'remote_project_id': fakes.PROJECT_ID + }) client_manager = self._clientmanager_class()( cli_options=cloud_config.CloudConfig( name='t1', region='1', - config=dict( - auth_type='password', - auth=AUTH_DICT, - interface=fakes.INTERFACE, - region_name=fakes.REGION_NAME, - service_provider=fakes.SERVICE_PROVIDER_ID, - remote_project_id=fakes.PROJECT_ID - ), + config=cli_options, auth_plugin=auth_plugin, ), api_version={