[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] get_tor_controller() is already authenticated
commit fd4e8f536c6efddabbece151bd26f2835e0d2f53
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sun Mar 22 14:53:36 2015 -0700
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.
---
test/integ/control/controller.py | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index 7873acc..1bfdad7 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
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits