Updated test_policy.py

pull/58/head
Sheng 2018-11-15 19:49:45 +08:00
parent 0cb0706c69
commit 646621279b
1 changed files with 10 additions and 0 deletions

View File

@ -78,6 +78,16 @@ class TestPolicy(unittest.TestCase):
autoadd.is_missing_host_key(client, hostname, key)
)
for f in [file1, file2]:
entry = paramiko.hostkeys.HostKeys(f)._entries[0]
hostname = entry.hostnames[0]
key = entry.key
key.get_name = lambda: 'unknown'
self.assertTrue(
autoadd.is_missing_host_key(client, hostname, key)
)
del key.get_name
for f in [file1, file2]:
entry = paramiko.hostkeys.HostKeys(f)._entries[0]
hostname = entry.hostnames[0][1:]