[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Add more test cases for re-attaching event listeners



commit b20d7acc9cd6fad1fd17f8dddccf8473d0034a09
Author: Sean Robinson <seankrobinson@xxxxxxxxx>
Date:   Sat Dec 15 15:32:47 2012 -0700

    Add more test cases for re-attaching event listeners
    
    This covers the three anticipated cases when re-attaching event listeners
    is required: Controller.authenticate(), stem.connection.authenticate(),
    and BaseController.msg("AUTHENTICATE").
    
    Signed-off-by: Sean Robinson <seankrobinson@xxxxxxxxx>
---
 test/integ/control/controller.py |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index e3abdbd..0cee344 100644
--- a/test/integ/control/controller.py
+++ b/test/integ/control/controller.py
@@ -13,6 +13,7 @@ import threading
 import time
 import unittest
 
+import stem.connection
 import stem.control
 import stem.descriptor.reader
 import stem.descriptor.router_status_entry
@@ -147,6 +148,34 @@ class TestController(unittest.TestCase):
       
       event_notice.wait(2)
       self.assertTrue(len(event_buffer) >= 1)
+      
+      # disconnect
+      
+      controller.close()
+      event_notice.clear()
+      event_buffer = []
+      
+      # reconnect and check that we get events again
+      
+      controller.connect()
+      stem.connection.authenticate(controller)
+      
+      event_notice.wait(2)
+      self.assertTrue(len(event_buffer) >= 1)
+      
+      # disconnect
+      
+      controller.close()
+      event_notice.clear()
+      event_buffer = []
+      
+      # reconnect and check that we get events again
+      
+      controller.connect()
+      controller.msg("AUTHENTICATE")
+      
+      event_notice.wait(2)
+      self.assertTrue(len(event_buffer) >= 1)
   
   def test_getinfo(self):
     """

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits