c1c137cdaaa41e76a8d36753cec34d16054f82ee
[yardstick.git] / yardstick / tests / unit / benchmark / scenarios / lib / test_create_sec_group.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_sec_group import CreateSecgroup
13
14
15 class CreateSecGroupTestCase(unittest.TestCase):
16
17     @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
18     @mock.patch('yardstick.common.openstack_utils.create_security_group_full')
19     def test_create_sec_group(self, mock_get_neutron_client, mock_create_security_group_full):
20         options = {
21             'openstack_paras': {
22                 'sg_name': 'yardstick_sec_group',
23                 'description': 'security group for yardstick manual VM'
24             }
25         }
26         args = {"options": options}
27         obj = CreateSecgroup(args, {})
28         obj.run({})
29         self.assertTrue(mock_get_neutron_client.called)
30         self.assertTrue(mock_create_security_group_full.called)
31
32
33 def main():
34     unittest.main()
35
36
37 if __name__ == '__main__':
38     main()