diff options
author | Cedric Ollivier <cedric.ollivier@orange.com> | 2018-02-13 10:14:00 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-02-13 10:14:00 +0000 |
commit | ae6798b7018e609d7a4833599e7915cebc258ac5 (patch) | |
tree | 282ef0863bd3d3316ccfd6e20df185e527a5aa01 | |
parent | 5387e9adab29aa72a0cbdea0615799eccaf6781d (diff) | |
parent | dd168d1587838be11d7a8372f77b16915a3af85b (diff) |
Merge "Improve the way of getting env values"
-rw-r--r-- | functest/cli/commands/cli_os.py | 4 | ||||
-rw-r--r-- | functest/cli/commands/cli_tier.py | 6 | ||||
-rw-r--r-- | functest/tests/unit/cli/commands/test_cli_os.py | 1 | ||||
-rw-r--r-- | functest/tests/unit/cli/test_cli_base.py | 2 |
4 files changed, 8 insertions, 5 deletions
diff --git a/functest/cli/commands/cli_os.py b/functest/cli/commands/cli_os.py index 7595caab7..0cf286238 100644 --- a/functest/cli/commands/cli_os.py +++ b/functest/cli/commands/cli_os.py @@ -20,10 +20,10 @@ from functest.utils.constants import CONST class OpenStack(object): def __init__(self): - self.os_auth_url = CONST.__getattribute__('OS_AUTH_URL') + self.os_auth_url = os.environ['OS_AUTH_URL'] self.endpoint_ip = None self.endpoint_port = None - self.openstack_creds = CONST.__getattribute__('env_file') + self.openstack_creds = getattr(CONST, 'env_file') if self.os_auth_url: self.endpoint_ip = urllib.parse.urlparse(self.os_auth_url).hostname self.endpoint_port = urllib.parse.urlparse(self.os_auth_url).port diff --git a/functest/cli/commands/cli_tier.py b/functest/cli/commands/cli_tier.py index 7aa3f714e..933d8cd63 100644 --- a/functest/cli/commands/cli_tier.py +++ b/functest/cli/commands/cli_tier.py @@ -8,12 +8,12 @@ # pylint: disable=missing-docstring +import os import pkg_resources import click from functest.ci import tier_builder -from functest.utils.constants import CONST from functest.utils import functest_utils @@ -21,8 +21,8 @@ class Tier(object): def __init__(self): self.tiers = tier_builder.TierBuilder( - CONST.__getattribute__('INSTALLER_TYPE'), - CONST.__getattribute__('DEPLOY_SCENARIO'), + os.environ['INSTALLER_TYPE'], + os.environ['DEPLOY_SCENARIO'], pkg_resources.resource_filename('functest', 'ci/testcases.yaml')) def list(self): diff --git a/functest/tests/unit/cli/commands/test_cli_os.py b/functest/tests/unit/cli/commands/test_cli_os.py index 1626ab1bc..02392d2df 100644 --- a/functest/tests/unit/cli/commands/test_cli_os.py +++ b/functest/tests/unit/cli/commands/test_cli_os.py @@ -26,6 +26,7 @@ class CliOpenStackTesting(unittest.TestCase): self.installer_ip = 'test_installer_ip' self.openstack_creds = 'test_env_file' self.snapshot_file = 'test_snapshot_file' + os.environ["OS_AUTH_URL"] = '' self.cli_os = cli_os.CliOpenStack() def test_ping_endpoint_default(self): diff --git a/functest/tests/unit/cli/test_cli_base.py b/functest/tests/unit/cli/test_cli_base.py index 876e8aa15..185a52204 100644 --- a/functest/tests/unit/cli/test_cli_base.py +++ b/functest/tests/unit/cli/test_cli_base.py @@ -10,6 +10,7 @@ # pylint: disable=missing-docstring import logging +import os import unittest import mock @@ -19,6 +20,7 @@ with mock.patch('functest.cli.commands.cli_testcase.CliTestcase.__init__', mock.Mock(return_value=None)), \ mock.patch('functest.cli.commands.cli_tier.CliTier.__init__', mock.Mock(return_value=None)): + os.environ['OS_AUTH_URL'] = '' from functest.cli import cli_base |