[tor-commits] [stem/master] Exercising the get_socket arg with integ testing

atagar at torproject.org atagar at torproject.org
Mon Nov 28 18:10:26 UTC 2011


commit 206e4de3ffab8764aefbc02d969092cc47dfc37a
Author: Damian Johnson <atagar at torproject.org>
Date:   Mon Nov 28 07:00:45 2011 -0800

    Exercising the get_socket arg with integ testing
    
    The get_socket (previously keep_alive) argument wasn't being exercised so
    adding that to the test for fetching a protocolinfo response via the control
    socket.
---
 test/integ/connection/protocolinfo.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/test/integ/connection/protocolinfo.py b/test/integ/connection/protocolinfo.py
index e1436f8..b22d0c9 100644
--- a/test/integ/connection/protocolinfo.py
+++ b/test/integ/connection/protocolinfo.py
@@ -101,8 +101,13 @@ class TestProtocolInfo(unittest.TestCase):
     connection_type = test.runner.get_runner().get_connection_type()
     
     if test.runner.OPT_SOCKET in test.runner.CONNECTION_OPTS[connection_type]:
-      protocolinfo_response = stem.connection.get_protocolinfo_by_socket(socket_path = test.runner.CONTROL_SOCKET_PATH)
+      protocolinfo_response, control_socket = stem.connection.get_protocolinfo_by_socket(socket_path = test.runner.CONTROL_SOCKET_PATH, get_socket = True)
       self.assert_protocolinfo_attr(protocolinfo_response, connection_type)
+      
+      # also exercising the get_socket argument - we should have a usable
+      # socket at this point
+      self.assertTrue(control_socket.is_alive())
+      control_socket.close()
     else:
       # we don't have a control socket
       self.assertRaises(stem.socket.SocketError, stem.connection.get_protocolinfo_by_socket, test.runner.CONTROL_SOCKET_PATH)





More information about the tor-commits mailing list