diff options
author | Juha Kosonen <juha.kosonen@nokia.com> | 2018-01-31 13:54:46 +0200 |
---|---|---|
committer | Juha Kosonen <juha.kosonen@nokia.com> | 2018-01-31 14:56:35 +0200 |
commit | 599aa4d480087e9ac24a67467f32431f18fe6d73 (patch) | |
tree | c746898ef8272773d4ce9759d0feb8efb78699ee | |
parent | bad712f34309cf4cf09701e900b832b2503761f6 (diff) |
Use snaps_utils to get credentials in tempest
Change-Id: I1d240d5edd536d71c87a7dff4e2676715697d0e2
Signed-off-by: Juha Kosonen <juha.kosonen@nokia.com>
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/tempest.py | 9 | ||||
-rw-r--r-- | functest/tests/unit/openstack/tempest/test_conf_utils.py | 6 | ||||
-rw-r--r-- | functest/tests/unit/openstack/tempest/test_tempest.py | 3 |
3 files changed, 7 insertions, 11 deletions
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index 4361784b6..29fcb48e2 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -311,15 +311,8 @@ class TempestDefcore(TempestCommon): class TempestResourcesManager(object): def __init__(self, **kwargs): - self.os_creds = None - if 'os_creds' in kwargs: - self.os_creds = kwargs['os_creds'] - else: - self.os_creds = openstack_tests.get_credentials( - os_env_file=CONST.__getattribute__('openstack_creds')) - + self.os_creds = kwargs.get('os_creds') or snaps_utils.get_credentials() self.guid = '-' + str(uuid.uuid4()) - self.creators = list() if hasattr(CONST, 'snaps_images_cirros'): diff --git a/functest/tests/unit/openstack/tempest/test_conf_utils.py b/functest/tests/unit/openstack/tempest/test_conf_utils.py index 137b9da66..1c168032a 100644 --- a/functest/tests/unit/openstack/tempest/test_conf_utils.py +++ b/functest/tests/unit/openstack/tempest/test_conf_utils.py @@ -33,7 +33,8 @@ class OSTempestConfUtilsTesting(unittest.TestCase): @mock.patch('snaps.openstack.utils.deploy_utils.create_image', return_value=mock.Mock()) def test_create_tempest_resources_missing_network_dic(self, *mock_args): - tempest_resources = tempest.TempestResourcesManager(os_creds={}) + tempest_resources = tempest.TempestResourcesManager( + os_creds=self.os_creds) with self.assertRaises(Exception) as context: tempest_resources.create() msg = 'Failed to create private network' @@ -48,7 +49,8 @@ class OSTempestConfUtilsTesting(unittest.TestCase): @mock.patch('snaps.openstack.utils.deploy_utils.create_image', return_value=None) def test_create_tempest_resources_missing_image(self, *mock_args): - tempest_resources = tempest.TempestResourcesManager(os_creds={}) + tempest_resources = tempest.TempestResourcesManager( + os_creds=self.os_creds) with self.assertRaises(Exception) as context: tempest_resources.create() diff --git a/functest/tests/unit/openstack/tempest/test_tempest.py b/functest/tests/unit/openstack/tempest/test_tempest.py index d1e2f14b8..292eb75bb 100644 --- a/functest/tests/unit/openstack/tempest/test_tempest.py +++ b/functest/tests/unit/openstack/tempest/test_tempest.py @@ -39,7 +39,8 @@ class OSTempestTesting(unittest.TestCase): mock.patch('functest.opnfv_tests.openstack.tempest.tempest.' 'conf_utils.get_verifier_deployment_dir', return_value='test_verifier_deploy_dir'), \ - mock.patch('snaps.openstack.tests.openstack_tests.get_credentials', + mock.patch('functest.opnfv_tests.openstack.snaps.snaps_utils.' + 'get_credentials', return_value=os_creds): self.tempestcommon = tempest.TempestCommon() self.tempestsmoke_serial = tempest.TempestSmokeSerial() |