test_sshclient.py 文件源码

python
阅读 53 收藏 0 点赞 0 评论 0

项目:os-xenapi 作者: openstack 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号