diff options
author | 2017-05-10 07:54:08 +0000 | |
---|---|---|
committer | 2017-05-10 07:54:08 +0000 | |
commit | 5b536321b8722f87715cab7bae3f6813bb73fd2a (patch) | |
tree | 0f6038f9628a67481684eeeed2c2d5f5e74467f8 /functest/tests/unit/odl | |
parent | ce80dec85ee484d5c0cd6ed2a48c60529938a706 (diff) | |
parent | f2bbfb690ce435c389b548d6b299ff82f658ea80 (diff) |
Merge "Conform ODL with last framework updates"
Diffstat (limited to 'functest/tests/unit/odl')
-rw-r--r-- | functest/tests/unit/odl/test_odl.py | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py index f3d37c65..d7ce70c7 100644 --- a/functest/tests/unit/odl/test_odl.py +++ b/functest/tests/unit/odl/test_odl.py @@ -109,6 +109,9 @@ class ODLParseResultTesting(ODLTesting): """The class testing ODLTests.parse_results().""" # pylint: disable=missing-docstring + _config = {'name': 'dummy', 'starttime': '20161216 16:00:00.000', + 'endtime': '20161216 16:00:01.000'} + @mock.patch('robot.api.ExecutionResult', side_effect=DataError) def test_raises_exc(self, mock_method): with self.assertRaises(DataError): @@ -116,15 +119,13 @@ class ODLParseResultTesting(ODLTesting): mock_method.assert_called_once_with( os.path.join(odl.ODLTests.res_dir, 'output.xml')) - def test_ok(self): - config = {'name': 'dummy', 'starttime': '20161216 16:00:00.000', - 'endtime': '20161216 16:00:01.000', 'status': 'PASS'} + def _test_result(self, config, result): suite = mock.Mock() suite.configure_mock(**config) with mock.patch('robot.api.ExecutionResult', return_value=mock.Mock(suite=suite)): self.test.parse_results() - self.assertEqual(self.test.result, config['status']) + self.assertEqual(self.test.result, result) self.assertEqual(self.test.start_time, timestamp_to_secs(config['starttime'])) self.assertEqual(self.test.stop_time, @@ -132,6 +133,26 @@ class ODLParseResultTesting(ODLTesting): self.assertEqual(self.test.details, {'description': config['name'], 'tests': []}) + def test_null_passed(self): + self._config.update({'statistics.critical.passed': 0, + 'statistics.critical.total': 20}) + self._test_result(self._config, 0) + + def test_no_test(self): + self._config.update({'statistics.critical.passed': 20, + 'statistics.critical.total': 0}) + self._test_result(self._config, 0) + + def test_half_success(self): + self._config.update({'statistics.critical.passed': 10, + 'statistics.critical.total': 20}) + self._test_result(self._config, 50) + + def test_success(self): + self._config.update({'statistics.critical.passed': 20, + 'statistics.critical.total': 20}) + self._test_result(self._config, 100) + class ODLRobotTesting(ODLTesting): |