summaryrefslogtreecommitdiff
path: root/openstackclient/tests/functional/base.py
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2019-01-08 15:39:58 +0000
committerMonty Taylor <mordred@inaugust.com>2019-01-10 14:21:03 +0000
commit2dd5393167119c043ae125fead9f8ed9ba84241d (patch)
treeeab196b97e3cc159048048286fdf4c273e8072e9 /openstackclient/tests/functional/base.py
parent2ab3396f19796935ddcb281b865d37839a4f84f7 (diff)
downloadpython-openstackclient-2dd5393167119c043ae125fead9f8ed9ba84241d.tar.gz
Use os-cloud instead of OS env vars for functional tests
In order to support switching auth contexts, such as for registered_limits which take a system scoped token, switch the functional tests to using the --os-cloud command line parameter. However, honor the OS_CLOUD env var as a way that someone can select a different cloud, including 'envvars', to use. Use devstack-system-admin cloud for limit tests Keystone requires these to have system scope now. Change-Id: Ia81eebd3e00ae986cf3ba7e3d98f3e8a1647b622
Diffstat (limited to 'openstackclient/tests/functional/base.py')
-rw-r--r--openstackclient/tests/functional/base.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/openstackclient/tests/functional/base.py b/openstackclient/tests/functional/base.py
index 90bbc24d..7705c655 100644
--- a/openstackclient/tests/functional/base.py
+++ b/openstackclient/tests/functional/base.py
@@ -24,6 +24,7 @@ COMMON_DIR = os.path.dirname(os.path.abspath(__file__))
FUNCTIONAL_DIR = os.path.normpath(os.path.join(COMMON_DIR, '..'))
ROOT_DIR = os.path.normpath(os.path.join(FUNCTIONAL_DIR, '..'))
EXAMPLE_DIR = os.path.join(ROOT_DIR, 'examples')
+ADMIN_CLOUD = os.environ.get('OS_ADMIN_CLOUD', 'devstack-admin')
def execute(cmd, fail_ok=False, merge_stderr=False):
@@ -59,9 +60,11 @@ class TestCase(testtools.TestCase):
delimiter_line = re.compile('^\+\-[\+\-]+\-\+$')
@classmethod
- def openstack(cls, cmd, fail_ok=False):
+ def openstack(cls, cmd, cloud=ADMIN_CLOUD, fail_ok=False):
"""Executes openstackclient command for the given action."""
- return execute('openstack ' + cmd, fail_ok=fail_ok)
+ return execute(
+ 'openstack --os-cloud={cloud} '.format(cloud=cloud) +
+ cmd, fail_ok=fail_ok)
@classmethod
def get_openstack_configuration_value(cls, configuration):