aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit/utils/test_openstack_utils.py
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-02-08 18:55:08 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2018-02-08 19:24:34 +0100
commit181e6d6e4828711744d451185d64c5c4939824fe (patch)
tree18722b0e324de7e11234c22dc44efd3d429dd262 /functest/tests/unit/utils/test_openstack_utils.py
parent89bb80232f777b0619d4168b292338c16a0a704c (diff)
Move source_credentials() into run_tests.py
It's also renamed source_envfile(). Change-Id: I0e7c38c2def125961f86dc2bc9a63cfb6ad87c03 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/tests/unit/utils/test_openstack_utils.py')
-rw-r--r--functest/tests/unit/utils/test_openstack_utils.py29
1 files changed, 0 insertions, 29 deletions
diff --git a/functest/tests/unit/utils/test_openstack_utils.py b/functest/tests/unit/utils/test_openstack_utils.py
index 216a6968..0a7177fc 100644
--- a/functest/tests/unit/utils/test_openstack_utils.py
+++ b/functest/tests/unit/utils/test_openstack_utils.py
@@ -9,7 +9,6 @@
import copy
import logging
-import os
import unittest
import mock
@@ -360,34 +359,6 @@ class OSUtilsTesting(unittest.TestCase):
def test_get_credentials_missing_endpoint_type(self):
self._get_credentials_missing_env('OS_ENDPOINT_TYPE')
- def _test_source_credentials(self, msg, key='OS_TENANT_NAME',
- value='admin'):
- try:
- del os.environ[key]
- except:
- pass
- f = 'rc_file'
- with mock.patch('six.moves.builtins.open',
- mock.mock_open(read_data=msg),
- create=True) as m:
- m.return_value.__iter__ = lambda self: iter(self.readline, '')
- openstack_utils.source_credentials(f)
- m.assert_called_once_with(f, 'r')
- self.assertEqual(os.environ[key], value)
-
- def test_source_credentials(self):
- self._test_source_credentials('OS_TENANT_NAME=admin')
- self._test_source_credentials('OS_TENANT_NAME= admin')
- self._test_source_credentials('OS_TENANT_NAME = admin')
- self._test_source_credentials('OS_TENANT_NAME = "admin"')
- self._test_source_credentials('export OS_TENANT_NAME=admin')
- self._test_source_credentials('export OS_TENANT_NAME =admin')
- self._test_source_credentials('export OS_TENANT_NAME = admin')
- self._test_source_credentials('export OS_TENANT_NAME = "admin"')
- # This test will fail as soon as rc_file is fixed
- self._test_source_credentials(
- 'export "\'OS_TENANT_NAME\'" = "\'admin\'"')
-
@mock.patch('functest.utils.openstack_utils.os.getenv',
return_value=None)
def test_get_keystone_client_version_missing_env(self, mock_os_getenv):