summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2014-12-17 14:29:18 -0800
committerJeff Forcier <jeff@bitprophet.org>2014-12-17 14:29:18 -0800
commit92d91a0222394650d6f5943bad7059834a611826 (patch)
treee0875935ade262e16d0a68e26d0443ad9dfddc47 /tests
parentc5836ad5524e52df87801ddd4f3a5187afae785f (diff)
parent40f9b9c7bc110523f7a6c18208e2c20220c1aeb4 (diff)
Merge branch 'master' into 419-int
Diffstat (limited to 'tests')
-rw-r--r--tests/test_util.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/test_util.py b/tests/test_util.py
index f961fbbc..7f68de21 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -27,8 +27,8 @@ from hashlib import sha1
import unittest
import paramiko.util
-from paramiko.util import lookup_ssh_host_config as host_config
-from paramiko.py3compat import StringIO, byte_ord
+from paramiko.util import lookup_ssh_host_config as host_config, safe_string
+from paramiko.py3compat import StringIO, byte_ord, b
test_config_file = """\
Host *
@@ -453,3 +453,14 @@ Host param3 parara
)
for host in incorrect_data:
self.assertRaises(Exception, conf._get_hosts, host)
+
+ def test_safe_string(self):
+ vanilla = b("vanilla")
+ has_bytes = b("has \7\3 bytes")
+ safe_vanilla = safe_string(vanilla)
+ safe_has_bytes = safe_string(has_bytes)
+ expected_bytes = b("has %07%03 bytes")
+ err = "{0!r} != {1!r}"
+ assert safe_vanilla == vanilla, err.format(safe_vanilla, vanilla)
+ assert safe_has_bytes == expected_bytes, \
+ err.format(safe_has_bytes, expected_bytes)