summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamian Johnson <atagar@torproject.org>2015-03-22 14:53:36 -0700
committerDamian Johnson <atagar@torproject.org>2015-03-22 14:53:36 -0700
commitfd4e8f536c6efddabbece151bd26f2835e0d2f53 (patch)
treeaf65845d083f867ce8540a21cb70bd0c742b9aae
parent40f87950078a1e167c454ecb52a4754c948d68df (diff)
get_tor_controller() is already authenticated
Unless you specify 'authenticate = False' the controller this provides is already connected and authenticated. Also, it's wise to always use this in a 'with' block so we still close the connection if we run into an error.
-rw-r--r--test/integ/control/controller.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index 7873acce..1bfdad7c 100644
--- a/test/integ/control/controller.py
+++ b/test/integ/control/controller.py
@@ -185,11 +185,10 @@ class TestController(unittest.TestCase):
event_buffer = []
# Spawn a second controller and trigger an event
- controller2 = runner.get_tor_controller()
- controller2.connect()
- controller2.authenticate(password = test.runner.CONTROL_PASSWORD)
- controller2.set_conf('NodeFamily', 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB')
- controller2.close()
+
+ with runner.get_tor_controller() as controller2:
+ controller2.set_conf('NodeFamily', 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB')
+
self.assertEqual(len(event_buffer), 0)
# reconnect and check that we get events again