[asterisk-commits] kmoore: testsuite/asterisk/trunk r5041 - /asterisk/trunk/lib/python/asterisk/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 15 12:50:44 CDT 2014


Author: kmoore
Date: Thu May 15 12:50:40 2014
New Revision: 5041

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5041
Log:
Testsuite: Allow HangupMonitor to expect a minimum number of calls

Modified:
    asterisk/trunk/lib/python/asterisk/pluggable_modules.py

Modified: asterisk/trunk/lib/python/asterisk/pluggable_modules.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/pluggable_modules.py?view=diff&rev=5041&r1=5040&r2=5041
==============================================================================
--- asterisk/trunk/lib/python/asterisk/pluggable_modules.py (original)
+++ asterisk/trunk/lib/python/asterisk/pluggable_modules.py Thu May 15 12:50:40 2014
@@ -241,6 +241,7 @@
         self.test_object = test_object
         self.test_object.register_ami_observer(self.__ami_connect)
         self.channels = []
+        self.num_calls = 0
 
     def __ami_connect(self, ami):
         """AMI connect handler"""
@@ -258,6 +259,9 @@
         """Handler for the Hangup event"""
         LOGGER.debug("Channel %s hungup" % event['channel'])
         self.channels.remove(event['channel'])
+        self.num_calls += 1
+        if 'min_calls' in self.__dict__ and self.num_calls < self.min_calls:
+            return (ami, event)
         if len(self.channels) == 0:
             LOGGER.info("All channels have hungup; stopping test")
             self.test_object.stop_reactor()




More information about the asterisk-commits mailing list