Prohibit the importation of a list of libraries
[yardstick.git] / yardstick / tests / unit / benchmark / scenarios / lib / test_create_server.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_server import CreateServer
13
14
15 class CreateServerTestCase(unittest.TestCase):
16
17     @mock.patch('yardstick.common.openstack_utils.create_instance_and_wait_for_active')
18     @mock.patch('yardstick.common.openstack_utils.get_nova_client')
19     @mock.patch('yardstick.common.openstack_utils.get_glance_client')
20     @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
21     def test_create_server(self, mock_get_nova_client, mock_get_neutron_client,
22                            mock_get_glance_client, mock_create_instance_and_wait_for_active):
23         scenario_cfg = {
24             'options': {
25                 'openstack_paras': 'example'
26             },
27             'output': 'server'
28         }
29         obj = CreateServer(scenario_cfg, {})
30         obj.run({})
31         self.assertTrue(mock_get_nova_client.called)
32         self.assertTrue(mock_get_glance_client.called)
33         self.assertTrue(mock_get_neutron_client.called)
34         self.assertTrue(mock_create_instance_and_wait_for_active.called)
35
36
37 def main():
38     unittest.main()
39
40
41 if __name__ == '__main__':
42     main()