Merge "Yardstick TC083: Move sample test case netperf"
[yardstick.git] / 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 import unittest
10 import mock
11
12 from yardstick.benchmark.scenarios.lib.create_keypair import CreateKeypair
13
14 PREFIX = "yardstick.benchmark.scenarios.lib.create_keypair"
15
16
17 class CreateKeypairTestCase(unittest.TestCase):
18     @mock.patch('{}.paramiko'.format(PREFIX))
19     @mock.patch('{}.op_utils'.format(PREFIX))
20     def test_create_keypair(self, mock_op_utils, mock_paramiko):
21         options = {
22             'key_name': 'yardstick_key',
23             'key_path': '/tmp/yardstick_key'
24         }
25         args = {"options": options}
26         obj = CreateKeypair(args, {})
27         obj.run({})
28         self.assertTrue(mock_op_utils.create_keypair.called)
29
30
31 def main():
32     unittest.main()
33
34
35 if __name__ == '__main__':
36     main()