Author: mjordan Date: Fri Aug 15 10:55:40 2014 New Revision: 5456 URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5456 Log: lib/python/asterisk/apptest: Fix callback errors with multiple actions
When an expected event has multiple actions, the current handling in apptest will erroneously pass the next actions to execute to the callback incorrectly. This is because it is passing the actions as a list, which is interpreted as a list of arguments to the callback functions. This causes hilarity, as a list of actions will only have some of those actions executed. Modified: asterisk/trunk/lib/python/asterisk/apptest.py Modified: asterisk/trunk/lib/python/asterisk/apptest.py URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/apptest.py?view=diff&rev=5456&r1=5455&r2=5456 ============================================================================== --- asterisk/trunk/lib/python/asterisk/apptest.py (original) +++ asterisk/trunk/lib/python/asterisk/apptest.py Fri Aug 15 10:55:40 2014 @@ -606,17 +606,19 @@ """Execute the next action in the sequence""" if (not actions or len(actions) == 0): + self.__current_action = 0 return LOGGER.debug("Executing action %d on %s" % (self.__current_action, str(self.channel_obj))) - ret_obj = actions.pop(0)(self.channel_obj) + action = actions.pop(0) + ret_obj = action(self.channel_obj) self.__current_action += 1 if ret_obj is not None: - ret_obj.addCallback(self.execute_next_action, actions) + ret_obj.addCallback(self.execute_next_action, actions=actions) else: - reactor.callLater(0, self.execute_next_action, actions) + reactor.callLater(0, self.execute_next_action, actions=actions) return result def dispose(self, ami): @@ -813,6 +815,7 @@ self.message_fields['Channel'] = test_object.get_channel_object(self.channel_id).app_channel LOGGER.debug('Sending message: %s' % str(self.message_fields)) channel_object.ami.sendMessage(self.message_fields) + return None class ActionFactory(object): -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- svn-commits mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/svn-commits