forked from paramiko/paramiko
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2003-2009 Robey Pointer <[email protected]> | ||
# | ||
# This file is part of paramiko. | ||
|
@@ -27,7 +28,7 @@ | |
import base64 | ||
|
||
from paramiko import RSAKey, DSSKey, ECDSAKey, Message, util | ||
from paramiko.py3compat import StringIO, byte_chr, b, bytes | ||
from paramiko.py3compat import StringIO, byte_chr, b, bytes, PY2 | ||
|
||
from tests.util import test_path | ||
|
||
|
@@ -107,6 +108,9 @@ | |
|
||
x1234 = b'\x01\x02\x03\x04' | ||
|
||
TEST_KEY_BYTESTR_2 = '\x00\x00\x00\x07ssh-rsa\x00\x00\x00\x01#\x00\x00\x00\x81\x00\xd3\x8fV\xea\x07\x85\xa6k%\x8d<\x1f\xbc\x8dT\x98\xa5\x96$\xf3E#\xbe>\xbc\xd2\x93\x93\x87f\xceD\x18\xdb \x0c\xb3\xa1a\x96\xf8e#\xcc\xacS\x8a#\xefVlE\x83\x1epv\xc1o\x17M\xef\xdf\x89DUXL\xa6\x8b\xaa<\x06\x10\xd7\x93w\xec\xaf\xe2\xaf\x95\xd8\xfb\xd9\xbfw\xcb\x9f0)#y{\x10\x90\xaa\x85l\tPru\x8c\t\x19\xce\xa0\xf1\xd2\xdc\x8e/\x8b\xa8f\x9c0\xdey\x84\xd2F\xf7\xcbmm\x1f\x87' | ||
TEST_KEY_BYTESTR_3 = '\x00\x00\x00\x07ssh-rsa\x00\x00\x00\x01#\x00\x00\x00\x00ӏV\x07k%<\x1fT$E#>ғfD\x18 \x0cae#̬S#VlE\x1epvo\x17M߉DUXL<\x06\x10דw\u2bd5ٿw˟0)#y{\x10l\tPru\t\x19Π\u070e/f0yFmm\x1f' | ||
|
||
|
||
class KeyTest (unittest.TestCase): | ||
|
||
|
@@ -427,3 +431,8 @@ def test_salt_size(self): | |
self.assertEqual(key, key2) | ||
finally: | ||
os.remove(newfile) | ||
|
||
def test_stringification(self): | ||
key = RSAKey.from_private_key_file(test_path('test_rsa.key')) | ||
comparable = TEST_KEY_BYTESTR_2 if PY2 else TEST_KEY_BYTESTR_3 | ||
self.assertEqual(str(key), comparable) |