forked from ParallelSSH/ssh-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_keytypes.py
More file actions
23 lines (17 loc) · 752 Bytes
/
Copy pathtest_keytypes.py
File metadata and controls
23 lines (17 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import unittest
from ssh.key import generate
from ssh.keytypes import key_type_from_name, RSAKey, ED25519Key, UnknownKey
class KeyTypesTest(unittest.TestCase):
def test_keygen(self):
key_type = RSAKey()
key = generate(key_type, 1024)
self.assertIsInstance(key.key_type(), RSAKey)
def test_key_type_from_name(self):
keytype = key_type_from_name('ssh-rsa')
self.assertIsInstance(keytype, RSAKey)
self.assertEqual(str(keytype), 'ssh-rsa')
keytype = key_type_from_name('ssh-ed25519')
self.assertIsInstance(keytype, ED25519Key)
self.assertEqual(str(keytype), 'ssh-ed25519')
def test_unknown_to_string(self):
self.assertEqual(str(UnknownKey()), 'unknown')