From 07e73e65dea6526ea835cbfe3f864a7e102f658c Mon Sep 17 00:00:00 2001 From: Linda Wang Date: Thu, 24 Aug 2017 03:17:35 +0000 Subject: Fix the tempest error when creating snapshot Change-Id: I9682f174a835d2bdf1ef3da01e369037e5ad7247 Signed-off-by: Linda Wang --- .../openstack/refstack_client/test_refstack_client.py | 4 +++- functest/tests/unit/openstack/tempest/test_conf_utils.py | 16 +--------------- 2 files changed, 4 insertions(+), 16 deletions(-) (limited to 'functest/tests/unit') diff --git a/functest/tests/unit/openstack/refstack_client/test_refstack_client.py b/functest/tests/unit/openstack/refstack_client/test_refstack_client.py index 5a2013181..ca0974832 100644 --- a/functest/tests/unit/openstack/refstack_client/test_refstack_client.py +++ b/functest/tests/unit/openstack/refstack_client/test_refstack_client.py @@ -36,7 +36,9 @@ class OSRefstackClientTesting(unittest.TestCase): username='user', password='pass', auth_url='http://foo.com:5000/v3', project_name='bar') - def _create_client(self): + @mock.patch('functest.opnfv_tests.openstack.refstack_client.tempest_conf.' + 'TempestConf', return_value=mock.Mock()) + def _create_client(self, mock_conf): with mock.patch('snaps.openstack.tests.openstack_tests.' 'get_credentials', return_value=self.os_creds): return RefstackClient() diff --git a/functest/tests/unit/openstack/tempest/test_conf_utils.py b/functest/tests/unit/openstack/tempest/test_conf_utils.py index 22017a7a2..77558086b 100644 --- a/functest/tests/unit/openstack/tempest/test_conf_utils.py +++ b/functest/tests/unit/openstack/tempest/test_conf_utils.py @@ -170,23 +170,9 @@ class OSTempestConfUtilsTesting(unittest.TestCase): def test_backup_tempest_config_default(self): with mock.patch('functest.opnfv_tests.openstack.tempest.' - 'conf_utils.os.path.exists', - return_value=False), \ - mock.patch('functest.opnfv_tests.openstack.tempest.' - 'conf_utils.os.makedirs') as m1, \ - mock.patch('functest.opnfv_tests.openstack.tempest.' - 'conf_utils.shutil.copyfile') as m2: + 'conf_utils.shutil.copyfile') as m1: conf_utils.backup_tempest_config('test_conf_file') self.assertTrue(m1.called) - self.assertTrue(m2.called) - - with mock.patch('functest.opnfv_tests.openstack.tempest.' - 'conf_utils.os.path.exists', - return_value=True), \ - mock.patch('functest.opnfv_tests.openstack.tempest.' - 'conf_utils.shutil.copyfile') as m2: - conf_utils.backup_tempest_config('test_conf_file') - self.assertTrue(m2.called) def test_configure_tempest_default(self): with mock.patch('functest.opnfv_tests.openstack.tempest.' -- cgit 1.2.3-korg