def test_import_public_key(self): """ Test for public key import""" new_key = KeyOperation.generate_new_pair() public_key = KeyOperation.import_key(new_key.publickey().exportKey()) self.assertFalse(public_key.has_private()) self.assertEqual(public_key.exportKey(), new_key.publickey().exportKey())
def test_invalid_key_import(self): """ Test for key import function with invalid key""" with self.assertRaises(Exception) as context: KeyOperation.import_key("Invalid Key") self.assertTrue( 'RSA key format is not supported' in str(context.exception))