diff options
author | Rex Lee <limingjiang@huawei.com> | 2017-04-24 01:58:31 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-04-24 01:58:31 +0000 |
commit | 07249e010dd9837d63f3090f1eac0fc6763b968f (patch) | |
tree | 7e9d12401220f547e499094fe8895d73fab405c5 /tests/unit/benchmark/scenarios/networking/test_netperf.py | |
parent | af7518c51362ce882972c4b2168dbbfa4f5dcb2d (diff) | |
parent | 99abbb424007da2e01762f3c040a39c0157cbe1f (diff) |
Merge "standardize ssh auth"
Diffstat (limited to 'tests/unit/benchmark/scenarios/networking/test_netperf.py')
-rwxr-xr-x | tests/unit/benchmark/scenarios/networking/test_netperf.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/unit/benchmark/scenarios/networking/test_netperf.py b/tests/unit/benchmark/scenarios/networking/test_netperf.py index 1b5dd6472..d0f862fb5 100755 --- a/tests/unit/benchmark/scenarios/networking/test_netperf.py +++ b/tests/unit/benchmark/scenarios/networking/test_netperf.py @@ -43,7 +43,7 @@ class NetperfTestCase(unittest.TestCase): def test_netperf_successful_setup(self, mock_ssh): p = netperf.Netperf({}, self.ctx) - mock_ssh.SSH().execute.return_value = (0, '', '') + mock_ssh.SSH.from_node().execute.return_value = (0, '', '') p.setup() self.assertIsNotNone(p.server) @@ -57,11 +57,11 @@ class NetperfTestCase(unittest.TestCase): result = {} p = netperf.Netperf(args, self.ctx) - mock_ssh.SSH().execute.return_value = (0, '', '') - p.host = mock_ssh.SSH() + mock_ssh.SSH.from_node().execute.return_value = (0, '', '') + p.host = mock_ssh.SSH.from_node() sample_output = self._read_sample_output() - mock_ssh.SSH().execute.return_value = (0, sample_output, '') + mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '') expected_result = jsonutils.loads(sample_output) p.run(result) self.assertEqual(result, expected_result) @@ -76,11 +76,11 @@ class NetperfTestCase(unittest.TestCase): result = {} p = netperf.Netperf(args, self.ctx) - mock_ssh.SSH().execute.return_value = (0, '', '') - p.host = mock_ssh.SSH() + mock_ssh.SSH.from_node().execute.return_value = (0, '', '') + p.host = mock_ssh.SSH.from_node() sample_output = self._read_sample_output() - mock_ssh.SSH().execute.return_value = (0, sample_output, '') + mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '') expected_result = jsonutils.loads(sample_output) p.run(result) self.assertEqual(result, expected_result) @@ -95,11 +95,11 @@ class NetperfTestCase(unittest.TestCase): result = {} p = netperf.Netperf(args, self.ctx) - mock_ssh.SSH().execute.return_value = (0, '', '') - p.host = mock_ssh.SSH() + mock_ssh.SSH.from_node().execute.return_value = (0, '', '') + p.host = mock_ssh.SSH.from_node() sample_output = self._read_sample_output() - mock_ssh.SSH().execute.return_value = (0, sample_output, '') + mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '') self.assertRaises(AssertionError, p.run, result) def test_netperf_unsuccessful_script_error(self, mock_ssh): @@ -109,10 +109,10 @@ class NetperfTestCase(unittest.TestCase): result = {} p = netperf.Netperf(args, self.ctx) - mock_ssh.SSH().execute.return_value = (0, '', '') - p.host = mock_ssh.SSH() + mock_ssh.SSH.from_node().execute.return_value = (0, '', '') + p.host = mock_ssh.SSH.from_node() - mock_ssh.SSH().execute.return_value = (1, '', 'FOOBAR') + mock_ssh.SSH.from_node().execute.return_value = (1, '', 'FOOBAR') self.assertRaises(RuntimeError, p.run, result) def _read_sample_output(self): |