3 ##############################################################################
4 # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
12 # Unittest for yardstick.cmd.commands.plugin
17 from yardstick.cmd.commands import plugin
22 self.input_file = ('plugin/sample_config.yaml',)
25 @mock.patch('yardstick.cmd.commands.plugin.ssh')
26 class pluginCommandsTestCase(unittest.TestCase):
31 def test_do_install(self, mock_ssh):
32 p = plugin.PluginCommands()
33 mock_ssh.SSH().execute.return_value = (0, '', '')
35 p.do_install(input_file)
37 self.assertEqual(self.result, expected_result)
39 def test_do_remove(self, mock_ssh):
40 p = plugin.PluginCommands()
41 mock_ssh.SSH().execute.return_value = (0, '', '')
43 p.do_remove(input_file)
45 self.assertEqual(self.result, expected_result)
47 def test_install_setup_run(self, mock_ssh):
48 p = plugin.PluginCommands()
49 mock_ssh.SSH().execute.return_value = (0, '', '')
58 plugin_name = plugins.get("name")
59 p._install_setup(plugin_name, deployment)
60 self.assertIsNotNone(p.client)
64 self.assertEqual(self.result, expected_result)
66 def test_remove_setup_run(self, mock_ssh):
67 p = plugin.PluginCommands()
68 mock_ssh.SSH().execute.return_value = (0, '', '')
77 plugin_name = plugins.get("name")
78 p._remove_setup(plugin_name, deployment)
79 self.assertIsNotNone(p.client)
83 self.assertEqual(self.result, expected_result)