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.benchmark.core.plugin
17 from yardstick.benchmark.core import plugin
22 self.input_file = ('plugin/sample_config.yaml',)
25 @mock.patch('yardstick.benchmark.core.plugin.ssh')
26 class pluginTestCase(unittest.TestCase):
31 def test_install(self, mock_ssh):
33 mock_ssh.SSH().execute.return_value = (0, '', '')
37 self.assertEqual(self.result, expected_result)
39 def test_remove(self, mock_ssh):
41 mock_ssh.SSH().execute.return_value = (0, '', '')
45 self.assertEqual(self.result, expected_result)
47 def test_install_setup_run(self, mock_ssh):
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):
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)
90 if __name__ == '__main__':