diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2017-11-17 09:45:55 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-11-17 09:45:55 +0000 |
commit | 3e00b3a1eb53889ede21578d75856ebaf633e5d9 (patch) | |
tree | 32b5f593415b6446cd11e57cf40f5df0517ea95e /tests/unit/benchmark/scenarios/test_base.py | |
parent | 1b9cc8a38a4866797bd49d006e22607b348f42ac (diff) | |
parent | 37dd0cbbcbcb1aa00b7f3aa2e74a6775c6a7f2fb (diff) |
Merge "Create get_description and get_scenario_type for Scenario"
Diffstat (limited to 'tests/unit/benchmark/scenarios/test_base.py')
-rw-r--r-- | tests/unit/benchmark/scenarios/test_base.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/unit/benchmark/scenarios/test_base.py b/tests/unit/benchmark/scenarios/test_base.py new file mode 100644 index 000000000..78e342978 --- /dev/null +++ b/tests/unit/benchmark/scenarios/test_base.py @@ -0,0 +1,53 @@ +# Copyright 2017: Intel Ltd. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import unittest + +from yardstick.benchmark.scenarios import base + + +class ScenarioTestCase(unittest.TestCase): + + def test_get_scenario_type(self): + scenario_type = 'dummy scenario' + + class DummyScenario(base.Scenario): + __scenario_type__ = scenario_type + + self.assertEqual(scenario_type, DummyScenario.get_scenario_type()) + + def test_get_scenario_type_not_defined(self): + class DummyScenario(base.Scenario): + pass + + self.assertEqual(str(None), DummyScenario.get_scenario_type()) + + def test_get_description(self): + docstring = """First line + Second line + Third line + """ + + class DummyScenario(base.Scenario): + __doc__ = docstring + + self.assertEqual(docstring.splitlines()[0], + DummyScenario.get_description()) + + def test_get_description_empty(self): + class DummyScenario(base.Scenario): + pass + + self.assertEqual(str(None), DummyScenario.get_description()) |