aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark/scenarios/compute/test_plugintest.py
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-03-01 17:28:46 -0800
committerJing Lu <lvjing5@huawei.com>2017-05-04 12:54:00 +0000
commit150481286dcf3c3c1fedd8213070cff48e5ad61d (patch)
treea8fc477a69e0a747612de328faaed57f55231973 /tests/unit/benchmark/scenarios/compute/test_plugintest.py
parent478a499e8cb048abf434559c8d47259ec238ed24 (diff)
standardize ssh auth
we need to be following defautl paramiko rules, first use pkey, then key_filenames (autodetecting ~/.ssh/ keys), then password We have too much boilerplate redudant code everywhere, we need to standardize on a factory function that takes a node dict. Using Python3 ChainMap we can layer overrides and defaults. VNF descriptors have to default key_filename, password to Python None. The only way to do this is to omit key values if the variable is not defined, this way the dict will not have the value and it will default to Python None Add python2 chainmap backport Updated unittest mocking to use ssh.SSH.from_node Change-Id: I80b0cb606e593b33e317c9e5e8ed0b74da591514 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com> (cherry picked from commit 99abbb424007da2e01762f3c040a39c0157cbe1f)
Diffstat (limited to 'tests/unit/benchmark/scenarios/compute/test_plugintest.py')
-rw-r--r--tests/unit/benchmark/scenarios/compute/test_plugintest.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/unit/benchmark/scenarios/compute/test_plugintest.py b/tests/unit/benchmark/scenarios/compute/test_plugintest.py
index a5331caf7..680f6ad65 100644
--- a/tests/unit/benchmark/scenarios/compute/test_plugintest.py
+++ b/tests/unit/benchmark/scenarios/compute/test_plugintest.py
@@ -40,7 +40,7 @@ class PluginTestTestCase(unittest.TestCase):
def test_sample_successful_setup(self, mock_ssh):
s = plugintest.PluginTest({}, self.ctx)
- mock_ssh.SSH().execute.return_value = (0, '', '')
+ mock_ssh.SSH.from_node().execute.return_value = (0, '', '')
s.setup()
self.assertIsNotNone(s.client)
@@ -50,7 +50,7 @@ class PluginTestTestCase(unittest.TestCase):
s = plugintest.PluginTest({}, self.ctx)
sample_output = '{"Test Output": "Hello world!"}'
- mock_ssh.SSH().execute.return_value = (0, sample_output, '')
+ mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '')
s.run(self.result)
expected_result = jsonutils.loads(sample_output)
self.assertEqual(self.result, expected_result)
@@ -58,5 +58,5 @@ class PluginTestTestCase(unittest.TestCase):
def test_sample_unsuccessful_script_error(self, mock_ssh):
s = plugintest.PluginTest({}, self.ctx)
- mock_ssh.SSH().execute.return_value = (1, '', 'FOOBAR')
+ mock_ssh.SSH.from_node().execute.return_value = (1, '', 'FOOBAR')
self.assertRaises(RuntimeError, s.run, self.result)