diff options
Diffstat (limited to 'functest/tests')
-rw-r--r-- | functest/tests/unit/ci/test_check_deployment.py | 8 | ||||
-rw-r--r-- | functest/tests/unit/openstack/rally/test_rally.py | 14 |
2 files changed, 16 insertions, 6 deletions
diff --git a/functest/tests/unit/ci/test_check_deployment.py b/functest/tests/unit/ci/test_check_deployment.py index 46dcc24c..aeeca587 100644 --- a/functest/tests/unit/ci/test_check_deployment.py +++ b/functest/tests/unit/ci/test_check_deployment.py @@ -45,25 +45,25 @@ class CheckDeploymentTesting(unittest.TestCase): @mock.patch('socket.socket.connect', side_effect=TypeError) def test_verify_connectivity_ko1(self, *args): self.assertFalse(check_deployment.verify_connectivity("127.0.0.1")) - args[0].assert_called_once_with(None, 80) + args[0].assert_called_once_with((None, 80)) @mock.patch('socket.socket.connect', side_effect=socket.error) def test_verify_connectivity_ko2(self, *args): self.assertFalse( check_deployment.verify_connectivity("http://127.0.0.1")) - args[0].assert_called_once_with("127.0.0.1", 80) + args[0].assert_called_once_with(("127.0.0.1", 80)) @mock.patch('socket.socket.connect', side_effect=socket.error) def test_verify_connectivity_ko3(self, *args): self.assertFalse( check_deployment.verify_connectivity("https://127.0.0.1")) - args[0].assert_called_once_with("127.0.0.1", 443) + args[0].assert_called_once_with(("127.0.0.1", 443)) @mock.patch('socket.socket.connect') def test_verify_connectivity(self, *args): self.assertTrue( check_deployment.verify_connectivity("https://127.0.0.1")) - args[0].assert_called_once_with("127.0.0.1", 443) + args[0].assert_called_once_with(("127.0.0.1", 443)) @mock.patch('snaps.openstack.utils.keystone_utils.keystone_session', return_value=mock.Mock( diff --git a/functest/tests/unit/openstack/rally/test_rally.py b/functest/tests/unit/openstack/rally/test_rally.py index f4858527..ba8a241f 100644 --- a/functest/tests/unit/openstack/rally/test_rally.py +++ b/functest/tests/unit/openstack/rally/test_rally.py @@ -220,7 +220,7 @@ class OSRallyTesting(unittest.TestCase): @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' '_build_task_args', return_value={}) @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' - '_get_output') + '_append_summary') @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' 'get_task_id', return_value=None) @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' @@ -242,7 +242,7 @@ class OSRallyTesting(unittest.TestCase): @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' '_build_task_args', return_value={}) @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' - '_get_output') + '_append_summary') @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' 'get_task_id', return_value='1') @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' @@ -424,6 +424,16 @@ class OSRallyTesting(unittest.TestCase): self.assertEqual(self.rally_base.run(), testcase.TestCase.EX_RUN_ERROR) mock_prep_env.assert_called() + def test_append_summary(self): + text = '[{"result":[{"error":[]},{"error":["err"]}],' \ + '"full_duration": 17.312026}]' + self.rally_base._append_summary(text, "foo_test") + self.assertEqual(self.rally_base.summary[0]['test_name'], "foo_test") + self.assertEqual(self.rally_base.summary[0]['overall_duration'], + 17.312026) + self.assertEqual(self.rally_base.summary[0]['nb_tests'], 2) + self.assertEqual(self.rally_base.summary[0]['nb_success'], 1) + if __name__ == "__main__": logging.disable(logging.CRITICAL) |