From 4d065d2f4080e935b4e3bab4cbcf2b97f8a61ed3 Mon Sep 17 00:00:00 2001 From: JingLu5 Date: Thu, 10 Aug 2017 06:00:58 +0000 Subject: Add common openstack opertation scenarios: flavor & server JIRA: YARDSTICK-781 This patch adds some common openstack opertation scenarios Change-Id: I9e84a8894fe9b9c1754a45a0ddfdf93739164b9a Signed-off-by: JingLu5 --- .../benchmark/scenarios/lib/test_create_flavor.py | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/unit/benchmark/scenarios/lib/test_create_flavor.py (limited to 'tests/unit/benchmark/scenarios/lib/test_create_flavor.py') diff --git a/tests/unit/benchmark/scenarios/lib/test_create_flavor.py b/tests/unit/benchmark/scenarios/lib/test_create_flavor.py new file mode 100644 index 000000000..036ae952d --- /dev/null +++ b/tests/unit/benchmark/scenarios/lib/test_create_flavor.py @@ -0,0 +1,37 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others. +# +# 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 unittest +import mock + +from yardstick.benchmark.scenarios.lib.create_flavor import CreateFlavor + + +class CreateFlavorTestCase(unittest.TestCase): + + @mock.patch('yardstick.common.openstack_utils.create_flavor') + def test_create_flavor(self, mock_create_flavor): + options = { + 'flavor_name': 'yardstick_test_flavor', + 'vcpus': '2', + 'ram': '1024', + 'disk': '100', + 'is_public': 'True' + } + args = {"options": options} + obj = CreateFlavor(args, {}) + obj.run({}) + self.assertTrue(mock_create_flavor.called) + + +def main(): + unittest.main() + + +if __name__ == '__main__': + main() -- cgit 1.2.3-korg