test_util.py 文件源码

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

项目:obsoleted-vpduserv 作者: InfraSIM 项目源码 文件源码
def test_5_host_keys(self):
        with open('hostfile.temp', 'w') as f:
            f.write(test_hosts_file)
        try:
            hostdict = paramiko.util.load_host_keys('hostfile.temp')
            self.assertEqual(2, len(hostdict))
            self.assertEqual(1, len(list(hostdict.values())[0]))
            self.assertEqual(1, len(list(hostdict.values())[1]))
            fp = hexlify(hostdict['secure.example.com']['ssh-rsa'].get_fingerprint()).upper()
            self.assertEqual(b'E6684DB30E109B67B70FF1DC5C7F1363', fp)
        finally:
            os.unlink('hostfile.temp')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号