aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit
diff options
context:
space:
mode:
authorCedric Ollivier <cedric.ollivier@orange.com>2018-01-27 10:02:12 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-01-27 10:02:12 +0000
commitc78fcdeed0ed74661484082801f16c14586b75d4 (patch)
treea6653f73f7154e654170791667d0b784993180a4 /functest/tests/unit
parentbbfe9b09d2b1ac7bfe286311fef83d36c6125c96 (diff)
parentb64d99f1e9f7dc625bb814135283bfa62088014a (diff)
Merge "Refactor rally report generation"
Diffstat (limited to 'functest/tests/unit')
-rw-r--r--functest/tests/unit/openstack/rally/test_rally.py14
1 files changed, 12 insertions, 2 deletions
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)