summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Tantsur <dtantsur@redhat.com>2016-05-19 12:28:41 +0200
committerJim Rollenhagen <jim@jimrollenhagen.com>2016-06-06 12:25:10 +0000
commit02ba7418902cfd7c12deedef56eb490b7d2c98a7 (patch)
treebdd2a108beffbaa24baa5d625e9ad3f1c3779826
parente7ed11c21f9f74833fc3df391b8bb9ec2d55372c (diff)
downloadironic-02ba7418902cfd7c12deedef56eb490b7d2c98a7.tar.gz
Stop unit-testing processutils internals
Change-Id: Ia0c469669417f7de7b35ccf517750b9ecaebbed0 Closes-Bug: #1583535 (cherry picked from commit 4f463617ac9274679185993f058741bd231d9dfc)
-rw-r--r--ironic/tests/drivers/test_ssh.py54
1 files changed, 0 insertions, 54 deletions
diff --git a/ironic/tests/drivers/test_ssh.py b/ironic/tests/drivers/test_ssh.py
index 043625230..09cea9f4c 100644
--- a/ironic/tests/drivers/test_ssh.py
+++ b/ironic/tests/drivers/test_ssh.py
@@ -534,60 +534,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):