[asterisk-commits] mjordan: testsuite/asterisk/trunk r3065 - in /asterisk/trunk/tests/channels/S...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Feb 26 17:17:29 CST 2012


Author: mjordan
Date: Sun Feb 26 17:17:25 2012
New Revision: 3065

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3065
Log:
Make SIP blind transfer tests tolerant of multiple channel status callback results

When checking for the success of a blind transfer, multiple results can be
returned, depending on the timing of the test.  The tests have now been changed
to iterate over the results checking each for the expected bridged channel, and
will only fail the test if no results contain the expected results.

Modified:
    asterisk/trunk/tests/channels/SIP/sip_blind_transfer/callee_refer_only/run-test
    asterisk/trunk/tests/channels/SIP/sip_blind_transfer/callee_with_reinvite/run-test
    asterisk/trunk/tests/channels/SIP/sip_blind_transfer/caller_refer_only/run-test
    asterisk/trunk/tests/channels/SIP/sip_blind_transfer/caller_with_reinvite/run-test

Modified: asterisk/trunk/tests/channels/SIP/sip_blind_transfer/callee_refer_only/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_blind_transfer/callee_refer_only/run-test?view=diff&rev=3065&r1=3064&r2=3065
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_blind_transfer/callee_refer_only/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/sip_blind_transfer/callee_refer_only/run-test Sun Feb 26 17:17:25 2012
@@ -96,7 +96,7 @@
         if channel == BlindTransfer.phone_c_channel:
             self.read_result()
 
-    def check_bridge_result(self, result):
+    def check_bridge_result(self, results):
         """ By now, we should have received the transfer event """
         if not self.transfer_event_received:
             logger.warn("Transfer event failed or contained incorrect data; not checking bridge results")
@@ -104,11 +104,19 @@
             self.read_result()
             return
 
-        logger.debug('Result %s' % str(result))
-        if "bridgedchannel" not in result[0]:
-            logger.warn("'bridgedchannel' not found")
-        elif result[0]['bridgedchannel'] == BlindTransfer.phone_c_channel:
-            self.passed = True
+        logger.debug('Results %s' % str(results))
+        """
+        Multiple results may be returned.  For example, at times, you may get a message
+        back that states "channel state will follow".  Iterate through each and only fail
+        if we don't get a match
+        """
+        i = 0
+        for result in results:
+            if "bridgedchannel" not in result:
+                logger.debug("'bridgedchannel' not found in result %d" % i)
+            elif result['bridgedchannel'] == BlindTransfer.phone_c_channel:
+                self.passed = True
+            i += 1
 
         if self.passed == True:
             logger.debug("Found Bridge!!!")

Modified: asterisk/trunk/tests/channels/SIP/sip_blind_transfer/callee_with_reinvite/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_blind_transfer/callee_with_reinvite/run-test?view=diff&rev=3065&r1=3064&r2=3065
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_blind_transfer/callee_with_reinvite/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/sip_blind_transfer/callee_with_reinvite/run-test Sun Feb 26 17:17:25 2012
@@ -96,7 +96,7 @@
         if channel == BlindTransfer.phone_c_channel:
             self.read_result()
 
-    def check_bridge_result(self, result):
+    def check_bridge_result(self, results):
         """ By now, we should have received the transfer event """
         if not self.transfer_event_received:
             logger.warn("Transfer event failed or contained incorrect data; not checking bridge results")
@@ -104,11 +104,19 @@
             self.read_result()
             return
 
-        logger.debug('Result %s' % str(result))
-        if "bridgedchannel" not in result[0]:
-            logger.warn("'bridgedchannel' not found")
-        elif result[0]['bridgedchannel'] == BlindTransfer.phone_c_channel:
-            self.passed = True
+        logger.debug('Results %s' % str(results))
+        """
+        Multiple results may be returned.  For example, at times, you may get a message
+        back that states "channel state will follow".  Iterate through each and only fail
+        if we don't get a match
+        """
+        i = 0
+        for result in results:
+            if "bridgedchannel" not in result:
+                logger.debug("'bridgedchannel' not found in result %d" % i)
+            elif result['bridgedchannel'] == BlindTransfer.phone_c_channel:
+                self.passed = True
+            i += 1
 
         if self.passed == True:
             logger.debug("Found Bridge!!!")

Modified: asterisk/trunk/tests/channels/SIP/sip_blind_transfer/caller_refer_only/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_blind_transfer/caller_refer_only/run-test?view=diff&rev=3065&r1=3064&r2=3065
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_blind_transfer/caller_refer_only/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/sip_blind_transfer/caller_refer_only/run-test Sun Feb 26 17:17:25 2012
@@ -97,7 +97,7 @@
         if channel == BlindTransfer.phone_c_channel:
             self.read_result()
 
-    def check_bridge_result(self, result):
+    def check_bridge_result(self, results):
         """ By now, we should have received the transfer event """
         if not self.transfer_event_received:
             logger.warn("Transfer event failed or contained incorrect data; not checking bridge results")
@@ -105,11 +105,19 @@
             self.read_result()
             return
 
-        logger.debug('Result %s' % str(result))
-        if "bridgedchannel" not in result[0]:
-            logger.warn("'bridgedchannel' not found")
-        elif result[0]['bridgedchannel'] == BlindTransfer.phone_c_channel:
-            self.passed = True
+        logger.debug('Results %s' % str(results))
+        """
+        Multiple results may be returned.  For example, at times, you may get a message
+        back that states "channel state will follow".  Iterate through each and only fail
+        if we don't get a match
+        """
+        i = 0
+        for result in results:
+            if "bridgedchannel" not in result:
+                logger.debug("'bridgedchannel' not found in result %d" % i)
+            elif result['bridgedchannel'] == BlindTransfer.phone_c_channel:
+                self.passed = True
+            i += 1
 
         if self.passed == True:
             logger.debug("Found Bridge!!!")

Modified: asterisk/trunk/tests/channels/SIP/sip_blind_transfer/caller_with_reinvite/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_blind_transfer/caller_with_reinvite/run-test?view=diff&rev=3065&r1=3064&r2=3065
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_blind_transfer/caller_with_reinvite/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/sip_blind_transfer/caller_with_reinvite/run-test Sun Feb 26 17:17:25 2012
@@ -103,7 +103,7 @@
         if channel == BlindTransfer.phone_c_channel:
             self.read_result()
 
-    def check_bridge_result(self, result):
+    def check_bridge_result(self, results):
         """ By now, we should have received the transfer event """
         if not self.transfer_event_received:
             logger.warn("Transfer event failed or contained incorrect data; not checking bridge results")
@@ -111,11 +111,19 @@
             self.read_result()
             return
 
-        logger.debug('Result %s' % str(result))
-        if "bridgedchannel" not in result[0]:
-            logger.warn("'bridgedchannel' not found")
-        elif result[0]['bridgedchannel'] == BlindTransfer.phone_c_channel:
-            self.passed = True
+        logger.debug('Results %s' % str(results))
+        """
+        Multiple results may be returned.  For example, at times, you may get a message
+        back that states "channel state will follow".  Iterate through each and only fail
+        if we don't get a match
+        """
+        i = 0
+        for result in results:
+            if "bridgedchannel" not in result:
+                logger.debug("'bridgedchannel' not found in result %d" % i)
+            elif result['bridgedchannel'] == BlindTransfer.phone_c_channel:
+                self.passed = True
+            i += 1
 
         if self.passed == True:
             logger.debug("Found Bridge!!!")




More information about the asterisk-commits mailing list