[tor-commits] [stem/master] Replacing runner authenticate with shiny new auth

atagar at torproject.org atagar at torproject.org
Wed Dec 21 18:02:41 UTC 2011


commit 22481b03901f84e9bc9d1951cc0f7343fbc6eb84
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Dec 21 09:00:58 2011 -0800

    Replacing runner authenticate with shiny new auth
    
    The test runner authenticated tor sockets manually for our integ tests.
    Replacing that with our nice, new general auth function.
---
 test/runner.py |   18 +-----------------
 1 files changed, 1 insertions(+), 17 deletions(-)

diff --git a/test/runner.py b/test/runner.py
index 566644b..6b5f6ea 100644
--- a/test/runner.py
+++ b/test/runner.py
@@ -345,24 +345,8 @@ class Runner:
       control_socket = stem.socket.ControlSocketFile(CONTROL_SOCKET_PATH)
     else: return None
     
-    # TODO: replace with higher level authentication functions when we have them
     if authenticate:
-      if OPT_COOKIE in conn_opts:
-        auth_cookie = open(cookie_path, "r")
-        auth_cookie_contents = auth_cookie.read()
-        auth_cookie.close()
-        
-        control_socket.send("AUTHENTICATE %s" % binascii.b2a_hex(auth_cookie_contents))
-      elif OPT_PASSWORD in conn_opts:
-        control_socket.send("AUTHENTICATE \"%s\"" % CONTROL_PASSWORD)
-      else:
-        control_socket.send("AUTHENTICATE")
-      
-      authenticate_response = control_socket.recv()
-      
-      if str(authenticate_response) != "OK":
-        # authentication was rejected
-        logging.error("AUTHENTICATE returned a failure response: %s" % authenticate_response)
+      stem.connection.authenticate(control_socket, CONTROL_PASSWORD)
     
     return control_socket
   





More information about the tor-commits mailing list