Merge "Stop downloading openbaton image."
[functest.git] / functest / tests / unit / openstack / tempest / test_conf_utils.py
index 7755808..22017a7 100644 (file)
@@ -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.'