aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit/openstack/tempest/test_tempest.py
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-04-12 20:58:01 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2018-04-12 21:05:55 +0200
commit71c4b3b719289929c226cae60eb1b23ada16eeb2 (patch)
treefd90e6fcd06f2f12152ac9d3e9962162c215b09a /functest/tests/unit/openstack/tempest/test_tempest.py
parent51acd93bfe71e2cbd897f071e58b641ccd5ca1ac (diff)
Fix role processing in Patrole
Role has to be listed in tempest.conf before calling testr. It also saves the right config file. Change-Id: Ifd122f31d0bfe3e9b3f93c6d62526acce96953d3 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/tests/unit/openstack/tempest/test_tempest.py')
-rw-r--r--functest/tests/unit/openstack/tempest/test_tempest.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/functest/tests/unit/openstack/tempest/test_tempest.py b/functest/tests/unit/openstack/tempest/test_tempest.py
index e2c4c975b..1fea4e41d 100644
--- a/functest/tests/unit/openstack/tempest/test_tempest.py
+++ b/functest/tests/unit/openstack/tempest/test_tempest.py
@@ -20,6 +20,7 @@ from functest.opnfv_tests.openstack.tempest import conf_utils
class OSTempestTesting(unittest.TestCase):
+ # pylint: disable=too-many-public-methods
def setUp(self):
os_creds = OSCreds(
@@ -101,6 +102,21 @@ class OSTempestTesting(unittest.TestCase):
with self.assertRaises(Exception):
self.tempestcommon.parse_verifier_result()
+ def test_backup_config_default(self):
+ with mock.patch('os.path.exists', return_value=False), \
+ mock.patch('os.makedirs') as mock_makedirs, \
+ mock.patch('shutil.copyfile') as mock_copyfile:
+ self.tempestcommon.backup_tempest_config(
+ 'test_conf_file', res_dir='test_dir')
+ self.assertTrue(mock_makedirs.called)
+ self.assertTrue(mock_copyfile.called)
+
+ with mock.patch('os.path.exists', return_value=True), \
+ mock.patch('shutil.copyfile') as mock_copyfile:
+ self.tempestcommon.backup_tempest_config(
+ 'test_conf_file', res_dir='test_dir')
+ self.assertTrue(mock_copyfile.called)
+
@mock.patch("os.rename")
@mock.patch("os.remove")
@mock.patch("os.path.exists", return_value=True)