test_HPELeftHandClient_MockSSH.py 文件源码

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

项目:deb-python-hplefthandclient 作者: openstack 项目源码 文件源码
def test_connect_without_password_and_private_key(self):
        ssh_client = ssh.HPELeftHandSSHClient(ip, user, password,
                                              known_hosts_file=None,
                                              missing_key_policy=paramiko.
                                              AutoAddPolicy)
        mock_expand_user = mock.Mock()
        mock_expand_user.return_value = 'my_user'

        mock_from_private_key_file = mock.Mock()
        mock_from_private_key_file.return_value = 'my_private_key'

        ssh_client.san_password = None
        ssh_client.san_privatekey = None

        ssh_client.ssh = mock.Mock()
        ssh_client.ssh.get_transport.return_value = False
        self.assertRaises(paramiko.SSHException, ssh_client.open)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号