[asterisk-commits] kmoore: branch group/bridge_construction r3755 - /asterisk/team/group/bridge_...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri May 3 13:37:49 CDT 2013
Author: kmoore
Date: Fri May 3 13:37:48 2013
New Revision: 3755
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3755
Log:
Add better error checking to bridge action test
Modified:
asterisk/team/group/bridge_construction/tests/manager/bridge_actions/check_bridge.py
asterisk/team/group/bridge_construction/tests/manager/bridge_actions/test-config.yaml
Modified: asterisk/team/group/bridge_construction/tests/manager/bridge_actions/check_bridge.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/group/bridge_construction/tests/manager/bridge_actions/check_bridge.py?view=diff&rev=3755&r1=3754&r2=3755
==============================================================================
--- asterisk/team/group/bridge_construction/tests/manager/bridge_actions/check_bridge.py (original)
+++ asterisk/team/group/bridge_construction/tests/manager/bridge_actions/check_bridge.py Fri May 3 13:37:48 2013
@@ -25,13 +25,22 @@
channel_count += 1
if channel_count < 2:
- LOGGER.error("Not enough channels in the bridge")
- if channel_count > 2:
- LOGGER.error("Too many channels in the bridge")
+ self.send_error("Not enough channels in the bridge")
+ elif channel_count > 2:
+ self.send_error("Too many channels in the bridge")
+ else:
+ self.send_success()
def failed(self, reason):
- LOGGER.error("BridgeInfo action failed: %s" % reason)
+ self.send_error("BridgeInfo action failed: %s" % reason)
pass
+
+ def send_error(self, message):
+ LOGGER.error(message)
+ self.ami.userEvent('BridgeInfoFailure', message=message})
+
+ def send_success(self):
+ self.ami.userEvent('BridgeInfoSuccess')
class bridge_list_callback_container:
def __init__(self, ami):
@@ -48,13 +57,14 @@
if bridge_id is None:
bridge_id = list_result['bridgeuniqueid']
else:
- LOGGER.error("More than one bridge returned where there should be only one")
+ self.send_error("More than one bridge returned where there should be only one")
return
if bridge_id is None:
- LOGGER.error("No bridges returned where there should be one")
+ self.send_error("No bridges returned where there should be one")
return
+ self.send_success()
message = {
'action' : 'BridgeInfo',
'bridgeuniqueid' : bridge_id
@@ -63,8 +73,15 @@
self.ami.collectDeferred(message, 'BridgeInfoComplete').addCallbacks(info_callback.callback, info_callback.failed)
def failed(self, reason):
- LOGGER.error("BridgeList action failed: %s" % reason)
+ self.send_error("BridgeList action failed: %s" % reason)
pass
+
+ def send_error(self, message):
+ LOGGER.error(message)
+ self.ami.userEvent('BridgeListFailure', message=message})
+
+ def send_success(self):
+ self.ami.userEvent('BridgeListSuccess')
def get_bridge_info(ami, event):
''' Callback called when the second participant entered the bridge.
Modified: asterisk/team/group/bridge_construction/tests/manager/bridge_actions/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/group/bridge_construction/tests/manager/bridge_actions/test-config.yaml?view=diff&rev=3755&r1=3754&r2=3755
==============================================================================
--- asterisk/team/group/bridge_construction/tests/manager/bridge_actions/test-config.yaml (original)
+++ asterisk/team/group/bridge_construction/tests/manager/bridge_actions/test-config.yaml Fri May 3 13:37:48 2013
@@ -33,6 +33,38 @@
callbackModule: 'check_bridge'
callbackMethod: 'get_bridge_info'
count: '1'
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'Userevent'
+ UserEvent: 'BridgeListFailure'
+ count: '0'
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'Userevent'
+ UserEvent: 'BridgeInfoFailure'
+ count: '0'
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'Userevent'
+ UserEvent: 'BridgeListSuccess'
+ count: '1'
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'Userevent'
+ UserEvent: 'BridgeInfoSuccess'
+ count: '1'
properties:
minversion: '12.0.0'
More information about the asterisk-commits
mailing list