036ae952d37a314767d5fc44a9d527a8aac69fde
[yardstick.git] / yardstick / tests / unit / benchmark / scenarios / lib / test_create_flavor.py
1 ##############################################################################
2 # Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 import unittest
10 import mock
11
12 from yardstick.benchmark.scenarios.lib.create_flavor import CreateFlavor
13
14
15 class CreateFlavorTestCase(unittest.TestCase):
16
17     @mock.patch('yardstick.common.openstack_utils.create_flavor')
18     def test_create_flavor(self, mock_create_flavor):
19         options = {
20             'flavor_name': 'yardstick_test_flavor',
21             'vcpus': '2',
22             'ram': '1024',
23             'disk': '100',
24             'is_public': 'True'
25         }
26         args = {"options": options}
27         obj = CreateFlavor(args, {})
28         obj.run({})
29         self.assertTrue(mock_create_flavor.called)
30
31
32 def main():
33     unittest.main()
34
35
36 if __name__ == '__main__':
37     main()