aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-03-10 21:06:37 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2018-03-10 21:23:11 +0100
commite1fa189b1c3dc69ab403658c4bd4396937db5ee0 (patch)
treebe7b5aa4266c65754cc1616711ee89c8b6e40072 /functest/tests/unit
parentc6de7a67e7a54722da02decf0df33c1f1e92af53 (diff)
Improve tempest files management
Calling apply_tempest_blacklist() is no longer mandatory. Change-Id: Id9a4e970c8acca066a36be89920745127867cd63 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/tests/unit')
-rw-r--r--functest/tests/unit/openstack/tempest/test_tempest.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/functest/tests/unit/openstack/tempest/test_tempest.py b/functest/tests/unit/openstack/tempest/test_tempest.py
index 2b9dcff44..7a2394918 100644
--- a/functest/tests/unit/openstack/tempest/test_tempest.py
+++ b/functest/tests/unit/openstack/tempest/test_tempest.py
@@ -84,7 +84,7 @@ class OSTempestTesting(unittest.TestCase):
cmd = ("cd {0};"
"testr list-tests {1} > {2};"
"cd -;".format(verifier_repo_dir, testr_mode,
- self.tempestcommon.raw_list))
+ self.tempestcommon.list))
self.tempestcommon.generate_test_list('test_verifier_repo_dir')
mock_exec.assert_called_once_with(cmd)
@@ -99,7 +99,10 @@ class OSTempestTesting(unittest.TestCase):
with self.assertRaises(Exception):
self.tempestcommon.parse_verifier_result()
- def test_apply_missing_blacklist(self):
+ @mock.patch("os.rename")
+ @mock.patch("os.remove")
+ @mock.patch("os.path.exists", return_value=True)
+ def test_apply_missing_blacklist(self, *args):
with mock.patch('__builtin__.open', mock.mock_open()) as mock_open, \
mock.patch.object(self.tempestcommon, 'read_file',
return_value=['test1', 'test2']):
@@ -110,8 +113,15 @@ class OSTempestTesting(unittest.TestCase):
obj = mock_open()
obj.write.assert_any_call('test1\n')
obj.write.assert_any_call('test2\n')
+ args[0].assert_called_once_with(self.tempestcommon.raw_list)
+ args[1].assert_called_once_with(self.tempestcommon.raw_list)
+ args[2].assert_called_once_with(
+ self.tempestcommon.list, self.tempestcommon.raw_list)
- def test_apply_blacklist_default(self):
+ @mock.patch("os.rename")
+ @mock.patch("os.remove")
+ @mock.patch("os.path.exists", return_value=True)
+ def test_apply_blacklist_default(self, *args):
item_dict = {'scenarios': ['deploy_scenario'],
'installers': ['installer_type'],
'tests': ['test2']}
@@ -126,6 +136,10 @@ class OSTempestTesting(unittest.TestCase):
obj = mock_open()
obj.write.assert_any_call('test1\n')
self.assertFalse(obj.write.assert_any_call('test2\n'))
+ args[0].assert_called_once_with(self.tempestcommon.raw_list)
+ args[1].assert_called_once_with(self.tempestcommon.raw_list)
+ args[2].assert_called_once_with(
+ self.tempestcommon.list, self.tempestcommon.raw_list)
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.LOGGER.info')
def test_run_verifier_tests_default(self, mock_logger_info):