From 1d8bb422bf8cf79b8a148e48c4c9b57966a43542 Mon Sep 17 00:00:00 2001 From: Pierce Lopez Date: Tue, 13 Jun 2017 13:37:14 -0400 Subject: implement __hash__() method for Ed25519Key makes Ed25519Key objs comparable, needed for host keys --- tests/test_pkey.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tests/test_pkey.py') diff --git a/tests/test_pkey.py b/tests/test_pkey.py index 6e589915..e614c777 100644 --- a/tests/test_pkey.py +++ b/tests/test_pkey.py @@ -455,9 +455,18 @@ class KeyTest(unittest.TestCase): key2 = Ed25519Key.from_private_key_file( test_path('test_ed25519_password.key'), b'abc123' ) - self.assertNotEqual(key1.asbytes(), key2.asbytes()) + def test_ed25519_compare(self): + # verify that the private & public keys compare equal + key = Ed25519Key.from_private_key_file(test_path('test_ed25519.key')) + self.assertEqual(key, key) + pub = Ed25519Key(data=key.asbytes()) + self.assertTrue(key.can_sign()) + self.assertTrue(not pub.can_sign()) + self.assertEqual(key, pub) + + def test_keyfile_is_actually_encrypted(self): # Read an existing encrypted private key file_ = test_path('test_rsa_password.key') -- cgit v1.2.3