[tor-commits] [stem/master] Couple minor fixes for tests

atagar at torproject.org atagar at torproject.org
Mon Sep 24 16:03:45 UTC 2012


commit 5a0da767e086aab1f196f60ed9fd042eb6825db4
Author: Damian Johnson <atagar at torproject.org>
Date:   Mon Sep 24 09:00:08 2012 -0700

    Couple minor fixes for tests
    
    Correcting an ImportError due to test.util being moved, and preventing the 'is
    valid IP' check from being a no-op.
---
 test/integ/control/controller.py |    8 ++++----
 test/util.py                     |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index 2af68c3..7c6708f 100644
--- a/test/integ/control/controller.py
+++ b/test/integ/control/controller.py
@@ -15,7 +15,7 @@ import stem.socket
 import stem.version
 import stem.response.protocolinfo
 import test.runner
-import test.utils
+import test.util
 
 class TestController(unittest.TestCase):
   def test_from_port(self):
@@ -418,13 +418,13 @@ class TestController(unittest.TestCase):
       
       s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
       s.connect(('127.0.0.1', int(controller.get_conf('SocksPort'))))
-      test.utils.negotiate_socks(s, '1.2.1.2', 80)
-      s.sendall(test.utils.ip_request) # make the http request for the ip address
+      test.util.negotiate_socks(s, '1.2.1.2', 80)
+      s.sendall(test.util.ip_request) # make the http request for the ip address
       response = s.recv(1000)
       
       # everything after the blank line is the 'data' in a HTTP response.
       # The response data for our request for request should be an IP address + '\n'
       ip_addr = response[response.find("\r\n\r\n"):].strip()
       
-      stem.util.connection.is_valid_ip_address(ip_addr)
+      self.assertTrue(stem.util.connection.is_valid_ip_address(ip_addr))
 
diff --git a/test/util.py b/test/util.py
index 51e9bd9..ddc96f0 100644
--- a/test/util.py
+++ b/test/util.py
@@ -37,7 +37,7 @@ def external_ip(sock):
     # The response data for our request for request should be an IP address + '\n'
     return response[response.find("\r\n\r\n"):].strip()
   except:
-    pass
+    return None
 
 def negotiate_socks(sock, host, port):
   """





More information about the tor-commits mailing list