[tor-commits] [stem/master] Basic verification integ test for general auth

atagar at torproject.org atagar at torproject.org
Tue Dec 20 18:02:27 UTC 2011


commit 6d30fe9c9ca67a167b0085306ee5590a26f61d4b
Author: Damian Johnson <atagar at torproject.org>
Date:   Tue Dec 20 10:01:02 2011 -0800

    Basic verification integ test for general auth
    
    Simple test that checks that the general authentication function can
    authenticate to all of our tor instances.
---
 run_tests.py                            |    4 ++--
 test/integ/connection/authentication.py |   12 +++++++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/run_tests.py b/run_tests.py
index 206de76..ddea103 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -42,8 +42,8 @@ UNIT_TESTS = (("stem.socket.ControlMessage", test.unit.socket.control_message.Te
              )
 
 INTEG_TESTS = (("stem.socket.ControlMessage", test.integ.socket.control_message.TestControlMessage),
-              ("stem.connection.authenticate_*", test.integ.connection.authentication.TestAuthenticate),
-              ("stem.connection.ProtocolInfoResponse", test.integ.connection.protocolinfo.TestProtocolInfo),
+              ("stem.connection.authenticate", test.integ.connection.authentication.TestAuthenticate),
+              ("stem.connection.get_protocolinfo", test.integ.connection.protocolinfo.TestProtocolInfo),
                ("stem.util.conf", test.integ.util.conf.TestConf),
                ("stem.util.system", test.integ.util.system.TestSystem),
               )
diff --git a/test/integ/connection/authentication.py b/test/integ/connection/authentication.py
index bfcf8e0..282a377 100644
--- a/test/integ/connection/authentication.py
+++ b/test/integ/connection/authentication.py
@@ -36,6 +36,16 @@ class TestAuthenticate(unittest.TestCase):
     if connection_type == test.runner.TorConnection.NONE:
       self.skipTest("(no connection)")
   
+  def test_authenticate_general(self):
+    """
+    Tests that the authenticate function can authenticate to our socket.
+    """
+    
+    control_socket = test.runner.get_runner().get_tor_socket(False)
+    stem.connection.authenticate(control_socket, test.runner.CONTROL_PASSWORD)
+    self._exercise_socket(control_socket)
+    control_socket.close()
+  
   def test_authenticate_general_example(self):
     """
     Tests the authenticate function with something like its pydoc example.
@@ -66,7 +76,7 @@ class TestAuthenticate(unittest.TestCase):
         self._exercise_socket(control_socket)
       except stem.connection.PasswordAuthFailed:
         self.fail()
-    except stem.connection.AuthenticationFailure, exc:
+    except stem.connection.AuthenticationFailure:
       self.fail()
     finally:
       control_socket.close()



More information about the tor-commits mailing list