[asterisk-commits] mmichelson: branch mmichelson/bridge-tests r3364 - in /asterisk/team/mmichels...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jul 25 17:54:44 CDT 2012
Author: mmichelson
Date: Wed Jul 25 17:54:43 2012
New Revision: 3364
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3364
Log:
Add more error checking for feature detection.
I can now confirm that all is working and I could conceivably
write necessary two-party bridge tests that involve features.
What still cannot be done at the moment are mid-call events.
These will likely be relegated to their own modules that can
be told when it is time to attempt to do their thing.
The code also needs some good old-fashioned cleanup done to
it because it is currently a mess of spaghetti code.
Modified:
asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/BridgeTestCase.py
asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/test-config.yaml
Modified: asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/BridgeTestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/BridgeTestCase.py?view=diff&rev=3364&r1=3363&r2=3364
==============================================================================
--- asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/BridgeTestCase.py (original)
+++ asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/BridgeTestCase.py Wed Jul 25 17:54:43 2012
@@ -232,6 +232,15 @@
LOGGER.warning("Feature target must be 'alice' or 'bob'")
self.set_passed(False)
+ if feature['what'] not in BridgeTestCase.FEATURE_MAP:
+ LOGGER.warning("Unknown feature requested")
+ self.set_passed(False)
+
+ if feature['success'] == 'true':
+ self.feature_success = True
+ else:
+ self.feature_success = False
+
LOGGER.info("Sending feature %s to %s" % (feature['what'],
feature['who']))
ami.playDTMF(channel, BridgeTestCase.FEATURE_MAP[feature['what']])
@@ -244,11 +253,22 @@
# We don't care about features yet, so
# just return
return
- if event.get('result') == 'pass':
+
+ LOGGER.info("Got FEATURE_DETECTION event")
+ if event.get('result') == 'success':
LOGGER.info("Feature detected was %s" % event.get('feature'))
+ if not self.feature_success:
+ LOGGER.warning("Feature succeeded when failure expected")
+ self.set_passed(False)
+ elif (self.features[self.current_feature]['what'] !=
+ event.get('feature')):
+ LOGGER.warning("Unexpected feature triggered")
+ self.set_passed(False)
else:
LOGGER.info("No feature detected")
- LOGGER.info("Got FEATURE_DETECTION event")
+ if self.feature_success:
+ LOGGER.warning("Feature failed when success was expected")
+ self.set_passed(False)
# Move onto the next feature!
self.current_feature += 1
self.execute_features()
Modified: asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/test-config.yaml?view=diff&rev=3364&r1=3363&r2=3364
==============================================================================
--- asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/test-config.yaml (original)
+++ asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/test-config.yaml Wed Jul 25 17:54:43 2012
@@ -17,6 +17,14 @@
-
who: 'alice'
what: 'atxfer'
+ success: 'false'
+ -
+ who: 'bob'
+ what: 'atxfer'
+ success: 'false'
+ -
+ who: 'alice'
+ what: 'automon'
success: 'true'
-
extension: 'test_call'
More information about the asterisk-commits
mailing list