Merge "Fixed document for Grafana Port usage"
[yardstick.git] / yardstick / tests / unit / benchmark / scenarios / lib / test_create_keypair.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
10 import mock
11 import unittest
12
13 from yardstick.benchmark.scenarios.lib import create_keypair
14
15
16 class CreateKeypairTestCase(unittest.TestCase):
17     @mock.patch.object(create_keypair, 'paramiko')
18     @mock.patch.object(create_keypair, 'op_utils')
19     def test_create_keypair(self, mock_op_utils, *args):
20         options = {
21             'key_name': 'yardstick_key',
22             'key_path': '/tmp/yardstick_key'
23         }
24         args = {"options": options}
25         obj = create_keypair.CreateKeypair(args, {})
26         obj.run({})
27         mock_op_utils.create_keypair.assert_called_once()
28
29
30 def main():
31     unittest.main()
32
33
34 if __name__ == '__main__':
35     main()