summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobey Pointer <robey@lag.net>2006-03-09 00:04:50 -0800
committerRobey Pointer <robey@lag.net>2006-03-09 00:04:50 -0800
commitde6315b9c5813ef846a3e97cb815c12505254fc9 (patch)
treead50a3d71e116d20d9a47ee5a1b42bbccd58375f /tests
parent90a577c775c4a985455e30fbc4bc44f05c61a3e8 (diff)
downloadparamiko-de6315b9c5813ef846a3e97cb815c12505254fc9.tar.gz
[project @ robey@lag.net-20060309080450-bad95b03d60d3d4f]
improve HostKeys so that it more correctly emulates a dict, and add a unit test to verify that
Diffstat (limited to 'tests')
-rw-r--r--tests/test_hostkeys.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_hostkeys.py b/tests/test_hostkeys.py
index 13426387..6f8eb57e 100644
--- a/tests/test_hostkeys.py
+++ b/tests/test_hostkeys.py
@@ -71,3 +71,14 @@ class HostKeysTest (unittest.TestCase):
fp = paramiko.util.hexify(x['ssh-rsa'].get_fingerprint())
self.assertEquals('7EC91BB336CB6D810B124B1353C32396', fp)
self.assertTrue(hostdict.check('foo.example.com', key))
+
+ def test_3_dict(self):
+ hostdict = paramiko.HostKeys('hostfile.temp')
+ self.assert_('secure.example.com' in hostdict)
+ self.assert_('not.example.com' not in hostdict)
+ self.assert_(hostdict.has_key('secure.example.com'))
+ self.assert_(not hostdict.has_key('not.example.com'))
+ x = hostdict.get('secure.example.com', None)
+ self.assertTrue(x is not None)
+ fp = paramiko.util.hexify(x['ssh-rsa'].get_fingerprint())
+ self.assertEquals('E6684DB30E109B67B70FF1DC5C7F1363', fp)