def test_ssh_except(self, mock_exec, mock_conn, mock_set):
mock_log = mock.Mock()
mock_channel = mock.Mock()
mock_exec.return_value = (fake_channel_file(['input']),
fake_channel_file(['info'], mock_channel),
fake_channel_file(['err']))
mock_channel.recv_exit_status.return_value = -1
client = sshclient.SSHClient('ip', 'username', password='password',
log=mock_log)
self.assertRaises(sshclient.SshExecCmdFailure, client.ssh,
'fake_command', output=True)
评论列表
文章目录