commit b3a1cbc538dced7c97da7cd3cd48f42937ed3565 Author: Sean Robinson seankrobinson@gmail.com Date: Sat Dec 1 13:41:10 2012 -0700
Add unit tests for is_valid_circuit_id function
Signed-off-by: Sean Robinson seankrobinson@gmail.com --- test/unit/util/tor_tools.py | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/test/unit/util/tor_tools.py b/test/unit/util/tor_tools.py index 2ff3058..c5b2685 100644 --- a/test/unit/util/tor_tools.py +++ b/test/unit/util/tor_tools.py @@ -52,4 +52,29 @@ class TestTorTools(unittest.TestCase):
for nickname in invalid_nicknames: self.assertFalse(stem.util.tor_tools.is_valid_nickname(nickname)) + + def test_is_valid_circuit_id(self): + """ + Checks the is_valid_circuit_id function. + """ + + valid_circuit_ids = ( + "0", + "2", + "abcABC123", + ) + + invalid_circuit_ids = ( + "", + 0, + 2, + "toolonggggggggggg", + "bad_character", + ) + + for circuit_id in valid_circuit_ids: + self.assertTrue(stem.util.tor_tools.is_valid_circuit_id(circuit_id)) + + for circuit_id in invalid_circuit_ids: + self.assertFalse(stem.util.tor_tools.is_valid_circuit_id(circuit_id))
tor-commits@lists.torproject.org