aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit/openstack/tempest
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2017-09-05 02:49:56 +0000
committerLinda Wang <wangwulin@huawei.com>2017-09-05 07:13:21 +0000
commit48ab10bb0a1ae754309e0810b3d85acdf70c8225 (patch)
tree7476d63a25524ad0db92dde1047aa5139b91a11c /functest/tests/unit/openstack/tempest
parentbbe21a39bb86d1c548728ba3aaf98bb2a9419ec3 (diff)
Create results/tempest dir for refstack config
When generating refstack client reference tempest conf file, the step of tempest.conf backup is necessary. So if the dir results/tempest is absent, error shows: [Errno 2] No such file or directory: '/home/opnfv/functest/results/tempest/tempest.conf' Change-Id: I7aba5baff55a51881d125b28f99d71d0cc0a5c72 Signed-off-by: Linda Wang <wangwulin@huawei.com>
Diffstat (limited to 'functest/tests/unit/openstack/tempest')
-rw-r--r--functest/tests/unit/openstack/tempest/test_conf_utils.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/functest/tests/unit/openstack/tempest/test_conf_utils.py b/functest/tests/unit/openstack/tempest/test_conf_utils.py
index 77558086..22017a7a 100644
--- a/functest/tests/unit/openstack/tempest/test_conf_utils.py
+++ b/functest/tests/unit/openstack/tempest/test_conf_utils.py
@@ -170,9 +170,23 @@ class OSTempestConfUtilsTesting(unittest.TestCase):
def test_backup_tempest_config_default(self):
with mock.patch('functest.opnfv_tests.openstack.tempest.'
- 'conf_utils.shutil.copyfile') as m1:
+ '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.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.'