summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Tantsur <dtantsur@redhat.com>2016-05-19 12:28:41 +0200
committerDmitry Tantsur <divius.inside@gmail.com>2016-05-31 17:22:08 +0000
commitafe61d52330fb7edf7c694061d67aa1901da01c9 (patch)
tree4d666a4fd962e04fd18dad6528cd155bb8aeba45
parentf4d081ea1565dd31718b75344e20ad78a5355e77 (diff)
downloadironic-afe61d52330fb7edf7c694061d67aa1901da01c9.tar.gz
Stop unit-testing processutils internals
Change-Id: Ia0c469669417f7de7b35ccf517750b9ecaebbed0 Closes-Bug: #1583535 (cherry picked from commit 4f463617ac9274679185993f058741bd231d9dfc)
-rw-r--r--ironic/tests/unit/drivers/modules/test_ssh.py54
1 files changed, 0 insertions, 54 deletions
diff --git a/ironic/tests/unit/drivers/modules/test_ssh.py b/ironic/tests/unit/drivers/modules/test_ssh.py
index 76a1e0387..75c7a4b9b 100644
--- a/ironic/tests/unit/drivers/modules/test_ssh.py
+++ b/ironic/tests/unit/drivers/modules/test_ssh.py
@@ -553,60 +553,6 @@ class SSHPrivateMethodsTestCase(db_base.DbTestCase):
get_hosts_name_mock.assert_called_once_with(self.sshclient, info)
exec_ssh_mock.assert_called_once_with(self.sshclient, cmd_to_exec)
- def test_exec_ssh_command_good(self):
- class Channel(object):
- def recv_exit_status(self):
- return 0
-
- class Stream(object):
- def __init__(self, buffer=''):
- self.buffer = buffer
- self.channel = Channel()
-
- def read(self):
- return self.buffer
-
- def close(self):
- pass
-
- with mock.patch.object(self.sshclient, 'exec_command',
- autospec=True) as exec_command_mock:
- exec_command_mock.return_value = (Stream(),
- Stream('hello'),
- Stream())
- stdout, stderr = processutils.ssh_execute(self.sshclient,
- "command")
-
- self.assertEqual('hello', stdout)
- exec_command_mock.assert_called_once_with("command")
-
- def test_exec_ssh_command_fail(self):
- class Channel(object):
- def recv_exit_status(self):
- return 127
-
- class Stream(object):
- def __init__(self, buffer=''):
- self.buffer = buffer
- self.channel = Channel()
-
- def read(self):
- return self.buffer
-
- def close(self):
- pass
-
- with mock.patch.object(self.sshclient, 'exec_command',
- autospec=True) as exec_command_mock:
- exec_command_mock.return_value = (Stream(),
- Stream('hello'),
- Stream())
- self.assertRaises(processutils.ProcessExecutionError,
- processutils.ssh_execute,
- self.sshclient,
- "command")
- exec_command_mock.assert_called_once_with("command")
-
class SSHDriverTestCase(db_base.DbTestCase):