diff options
author | Cedric Ollivier <cedric.ollivier@orange.com> | 2017-05-30 15:02:06 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-05-30 15:02:06 +0000 |
commit | a28e2b40877f022f6cc8bbc3ad9b586ef3dd126c (patch) | |
tree | 015109b1867976702a2e90b050d00af0174f2b73 /functest/tests/unit/ci | |
parent | 8628e8f2bb97f4528767710ec8fdec5ea3643738 (diff) | |
parent | 49a7e57f112d855b0609721b6082b15a94417380 (diff) |
Merge "Define create_snapshot() and clean() in TestCase"
Diffstat (limited to 'functest/tests/unit/ci')
-rw-r--r-- | functest/tests/unit/ci/test_run_tests.py | 27 | ||||
-rw-r--r-- | functest/tests/unit/ci/test_tier_builder.py | 1 | ||||
-rw-r--r-- | functest/tests/unit/ci/test_tier_handler.py | 1 |
3 files changed, 10 insertions, 19 deletions
diff --git a/functest/tests/unit/ci/test_run_tests.py b/functest/tests/unit/ci/test_run_tests.py index 88e5d2b8..fb8cb391 100644 --- a/functest/tests/unit/ci/test_run_tests.py +++ b/functest/tests/unit/ci/test_run_tests.py @@ -38,8 +38,12 @@ class RunTestsTesting(unittest.TestCase): 'OS_PASSWORD': 'test_password'} self.test = {'test_name': 'test_name'} self.tier = mock.Mock() + test1 = mock.Mock() + test1.get_name.return_value = 'test1' + test2 = mock.Mock() + test2.get_name.return_value = 'test2' attrs = {'get_name.return_value': 'test_tier', - 'get_tests.return_value': ['test1', 'test2'], + 'get_tests.return_value': [test1, test2], 'get_ci_loop.return_value': 'test_ci_loop', 'get_test_names.return_value': ['test1', 'test2']} self.tier.configure_mock(**attrs) @@ -70,16 +74,6 @@ class RunTestsTesting(unittest.TestCase): return_value=self.creds): self.runner.source_rc_file() - @mock.patch('functest.ci.run_tests.os_snapshot.main') - def test_generate_os_snapshot(self, mock_os_snap): - self.runner.generate_os_snapshot() - self.assertTrue(mock_os_snap.called) - - @mock.patch('functest.ci.run_tests.os_clean.main') - def test_cleanup(self, mock_os_clean): - self.runner.cleanup() - self.assertTrue(mock_os_clean.called) - def test_get_run_dict_if_defined_default(self): mock_obj = mock.Mock() with mock.patch('functest.ci.run_tests.' @@ -137,8 +131,6 @@ class RunTestsTesting(unittest.TestCase): @mock.patch('functest.ci.run_tests.Runner.print_separator') @mock.patch('functest.ci.run_tests.Runner.source_rc_file') - @mock.patch('functest.ci.run_tests.Runner.generate_os_snapshot') - @mock.patch('functest.ci.run_tests.Runner.cleanup') @mock.patch('importlib.import_module', name="module", return_value=mock.Mock(test_class=mock.Mock( side_effect=FakeModule))) @@ -161,10 +153,10 @@ class RunTestsTesting(unittest.TestCase): def test_run_tier_default(self, mock_logger_info): with mock.patch('functest.ci.run_tests.Runner.print_separator'), \ mock.patch( - 'functest.ci.run_tests.Runner.run_test') as mock_method: + 'functest.ci.run_tests.Runner.run_test', + return_value=TestCase.EX_OK) as mock_method: self.runner.run_tier(self.tier) - mock_method.assert_any_call('test1', 'test_tier') - mock_method.assert_any_call('test2', 'test_tier') + mock_method.assert_any_call(mock.ANY, 'test_tier') self.assertTrue(mock_logger_info.called) @mock.patch('functest.ci.run_tests.logger.info') @@ -237,7 +229,8 @@ class RunTestsTesting(unittest.TestCase): with mock.patch('functest.ci.run_tests.tb.TierBuilder', return_value=mock_obj), \ mock.patch('functest.ci.run_tests.Runner.source_rc_file'), \ - mock.patch('functest.ci.run_tests.Runner.run_test') as m: + mock.patch('functest.ci.run_tests.Runner.run_test', + return_value=TestCase.EX_OK) as m: self.assertEqual(self.runner.main(**kwargs), run_tests.Result.EX_OK) self.assertTrue(m.called) diff --git a/functest/tests/unit/ci/test_tier_builder.py b/functest/tests/unit/ci/test_tier_builder.py index 989c0870..ab75e15b 100644 --- a/functest/tests/unit/ci/test_tier_builder.py +++ b/functest/tests/unit/ci/test_tier_builder.py @@ -24,7 +24,6 @@ class TierBuilderTesting(unittest.TestCase): 'case_name': 'test_name', 'criteria': 'test_criteria', 'blocking': 'test_blocking', - 'clean_flag': 'test_clean_flag', 'description': 'test_desc'} self.dic_tier = {'name': 'test_tier', diff --git a/functest/tests/unit/ci/test_tier_handler.py b/functest/tests/unit/ci/test_tier_handler.py index c93fffd3..1909ac22 100644 --- a/functest/tests/unit/ci/test_tier_handler.py +++ b/functest/tests/unit/ci/test_tier_handler.py @@ -34,7 +34,6 @@ class TierHandlerTesting(unittest.TestCase): self.mock_depend, 'test_criteria', 'test_blocking', - 'test_clean_flag', description='test_desc') self.dependency = tier_handler.Dependency('test_installer', |