コード例 #1
0
 def test_invalid_private_key2(self):
     with self.assertRaises(Exception) as ctx:
         SshKeyManager.check_keys(self.pub_key, None)
     self.assertEqual(str(ctx.exception), 'invalid private key')
コード例 #2
0
 def test_key_check_error2(self):
     with self.assertRaises(Exception) as ctx:
         SshKeyManager.check_keys(self.priv_key, None)
     self.assertEqual(str(ctx.exception), 'key pair does not match')
コード例 #3
0
 def test_key_check_error3(self):
     with self.assertRaises(Exception) as ctx:
         SshKeyManager.check_keys(None, None)
     self.assertEqual(str(ctx.exception), 'invalid private key')
コード例 #4
0
 def test_generate_key_pair(self):
     try:
         SshKeyManager.check_keys(self.priv_key, self.pub_key)
     except Exception:  # pylint: disable=broad-except
         self.fail('SshKeyManager.check_keys raised an Exception')