[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Check that tor_tools helpers work with both bytes and unicode



commit cbf9e45c7893ffade847c0a78e00ae484ccd3128
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sat Oct 28 18:06:16 2017 -0700

    Check that tor_tools helpers work with both bytes and unicode
    
    Thought these might be having an issue but turns out that's not the case. Good
    tests none the less.
---
 test/unit/util/tor_tools.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/test/unit/util/tor_tools.py b/test/unit/util/tor_tools.py
index c0881db0..5035d7b4 100644
--- a/test/unit/util/tor_tools.py
+++ b/test/unit/util/tor_tools.py
@@ -4,6 +4,7 @@ Unit tests for the stem.util.tor_tools functions.
 
 import unittest
 
+import stem.util.str_tools
 import stem.util.tor_tools
 
 
@@ -16,6 +17,8 @@ class TestTorTools(unittest.TestCase):
     valid_fingerprints = (
       '$A7569A83B5706AB1B1A9CB52EFF7D2D32E4553EB',
       '$a7569a83b5706ab1b1a9cb52eff7d2d32e4553eb',
+      stem.util.str_tools._to_bytes('$A7569A83B5706AB1B1A9CB52EFF7D2D32E4553EB'),
+      stem.util.str_tools._to_unicode('$A7569A83B5706AB1B1A9CB52EFF7D2D32E4553EB'),
     )
 
     invalid_fingerprints = (
@@ -44,6 +47,8 @@ class TestTorTools(unittest.TestCase):
       'caerSidi',
       'a',
       'abcABC123',
+      stem.util.str_tools._to_bytes('caerSidi'),
+      stem.util.str_tools._to_unicode('caerSidi'),
     )
 
     invalid_nicknames = (
@@ -69,6 +74,8 @@ class TestTorTools(unittest.TestCase):
       '0',
       '2',
       'abcABC123',
+      stem.util.str_tools._to_bytes('2'),
+      stem.util.str_tools._to_unicode('2'),
     )
 
     invalid_circuit_ids = (
@@ -94,6 +101,8 @@ class TestTorTools(unittest.TestCase):
     valid_hex_digits = (
       '12345',
       'AbCdE',
+      stem.util.str_tools._to_bytes('AbCdE'),
+      stem.util.str_tools._to_unicode('AbCdE'),
     )
 
     invalid_hex_digits = (



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits