aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2021-04-20 18:02:00 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2021-04-20 18:02:00 +0200
commitbe8185f6345d499c80c71bf0dbbd1402069e1c81 (patch)
tree09b7bf2a82bc4ebd78dd6a96e571fc45489699cf
parentde1ac63a189a2220ba7304555ad8ff60f626146e (diff)
Refactor test_run_verifier_tests_default
https://app.circleci.com/pipelines/github/collivier/functest/801/workflows/4e3262ab-3adf-4539-839c-eddd49bcc2c1/jobs/809 Change-Id: Id2f95a4d8db253449723bf48d190eac7928f038e Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r--functest/tests/unit/openstack/tempest/test_tempest.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/functest/tests/unit/openstack/tempest/test_tempest.py b/functest/tests/unit/openstack/tempest/test_tempest.py
index 71aa5a2..6ff404a 100644
--- a/functest/tests/unit/openstack/tempest/test_tempest.py
+++ b/functest/tests/unit/openstack/tempest/test_tempest.py
@@ -158,20 +158,17 @@ class OSTempestTesting(unittest.TestCase):
args[2].assert_called_once_with(
self.tempestcommon.list, self.tempestcommon.raw_list)
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'subprocess.Popen')
+ @mock.patch('six.moves.builtins.open', mock.mock_open())
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.LOGGER.info')
- def test_run_verifier_tests_default(self, mock_logger_info):
- with mock.patch('six.moves.builtins.open', mock.mock_open()), \
- mock.patch('six.moves.builtins.iter',
- return_value=[r'\} tempest\.']), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'subprocess.Popen'):
- self.tempestcommon.tempest_list = 'test_tempest_list'
- cmd = ["rally", "verify", "start", "--load-list",
- self.tempestcommon.tempest_list]
- with self.assertRaises(Exception):
- self.tempestcommon.run_verifier_tests()
- mock_logger_info. \
- assert_any_call("Starting Tempest test suite: '%s'.", cmd)
+ def test_run_verifier_tests_default(self, *args):
+ self.tempestcommon.tempest_list = 'test_tempest_list'
+ cmd = ["rally", "verify", "start", "--load-list",
+ self.tempestcommon.tempest_list]
+ with self.assertRaises(Exception):
+ self.tempestcommon.run_verifier_tests()
+ args[0].assert_any_call("Starting Tempest test suite: '%s'.", cmd)
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
'os.path.exists', return_value=False)