diff options
author | 2017-11-29 22:56:21 +0000 | |
---|---|---|
committer | 2018-02-12 16:57:56 +0000 | |
commit | ba4e9e6e47bd10ecc803bab920178ea973c2fa86 (patch) | |
tree | 54576c199cabe8ccc29d04eedfe0e4f88b2bd598 /tests/unit/benchmark/scenarios/parser/test_parser.py | |
parent | babe3cc2882e19c6dafdbf41d502d7ba5560635a (diff) |
Move tests: unit/benchmark
* Fix pylint errors
* Add TODOs
Some errors are ignored locally, as they were a symptom of other problems.
These issues have been flagged with a TODO, and should be fixed later.
Change-Id: I30eb4b0aafe0575d0cddbc946108291f21a98ed8
Jira: YARDSTICK-837
Signed-off-by: Emma Foley <emma.l.foley@intel.com>
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'tests/unit/benchmark/scenarios/parser/test_parser.py')
-rw-r--r-- | tests/unit/benchmark/scenarios/parser/test_parser.py | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/tests/unit/benchmark/scenarios/parser/test_parser.py b/tests/unit/benchmark/scenarios/parser/test_parser.py deleted file mode 100644 index ee2bbc07d..000000000 --- a/tests/unit/benchmark/scenarios/parser/test_parser.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env python - -############################################################################## -# Copyright (c) 2015 Huawei Technologies Co.,Ltd and other. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -import subprocess - -import unittest -import mock - -from oslo_serialization import jsonutils - -from yardstick.benchmark.scenarios.parser import parser - - -class ParserTestCase(unittest.TestCase): - - def setUp(self): - args = { - 'options': {'yangfile': '/root/yardstick/samples/yang.yaml', - 'toscafile': '/root/yardstick/samples/tosca.yaml'}, - } - self.scenario = parser.Parser(scenario_cfg=args, context_cfg={}) - - self._mock_popen = mock.patch.object(subprocess, 'Popen') - self.mock_popen = self._mock_popen.start() - self._mock_call = mock.patch.object(subprocess, 'call') - self.mock_call = self._mock_call.start() - - self.addCleanup(self._stop_mock) - - def _stop_mock(self): - self._mock_popen.stop() - self._mock_call.stop() - - def test_setup_successful(self): - - self.mock_call.return_value = 0 - self.scenario.setup() - self.assertTrue(self.scenario.setup_done) - - def test_run_successful(self): - - result = {} - - self.mock_popen().returncode = 0 - - expected_result = jsonutils.loads('{"yangtotosca": "success"}') - - self.scenario.run(result) - self.assertEqual(result, expected_result) - - def test_run_fail(self): - result = {} - - self.mock_popen().returncode = 1 - expected_result = jsonutils.loads('{"yangtotosca": "fail"}') - - self.scenario.run(result) - self.assertEqual(result, expected_result) - - def test_teardown_successful(self): - - self.mock_call.return_value = 0 - self.scenario.teardown() - self.assertTrue(self.scenario.teardown_done) - - -def main(): - unittest.main() - -if __name__ == '__main__': - main() |