[svn-commits] mjordan: testsuite/asterisk/trunk r5449 - in /asterisk/trunk: lib/python/aste...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu Aug 14 16:12:27 CDT 2014
Author: mjordan
Date: Thu Aug 14 16:12:22 2014
New Revision: 5449
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5449
Log:
tests/apps/authenticate: Add off nominal authenticate test
This test uses the dialplan to enter the Authenticate application, which has
been given a hard coded password, and sends the wrong dtmf password three
times. The Authenticate application should respond twice with the sound file
"auth-incorrect", and then after a third incorrect try, play "vm-goodbye" and
end the session.
This test checks using a header match that "auth-incorrect" is played twice,
followed by "vm-goodbye".
Review: https://reviewboard.asterisk.org/r/3693/
ASTERISK-23953 #close
patches:
auth_fail.diff uploaded by tcambron (License 6611)
Added:
asterisk/trunk/tests/apps/authenticate/
asterisk/trunk/tests/apps/authenticate/off_nominal/
asterisk/trunk/tests/apps/authenticate/off_nominal/configs/
asterisk/trunk/tests/apps/authenticate/off_nominal/configs/ast1/
asterisk/trunk/tests/apps/authenticate/off_nominal/configs/ast1/extensions.conf (with props)
asterisk/trunk/tests/apps/authenticate/off_nominal/test-config.yaml (with props)
asterisk/trunk/tests/apps/authenticate/tests.yaml (with props)
Modified:
asterisk/trunk/lib/python/asterisk/apptest.py
asterisk/trunk/tests/apps/tests.yaml
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=5449&r1=5448&r2=5449
==============================================================================
--- asterisk/trunk/lib/python/asterisk/apptest.py (original)
+++ asterisk/trunk/lib/python/asterisk/apptest.py Thu Aug 14 16:12:22 2014
@@ -586,9 +586,11 @@
def event_callback(self, ami, event):
"""Override of AMIEventInstance event_callback."""
+ actions = list(self.actions)
+
# If we aren't matching on a channel, then just execute the actions
if 'channel' not in event or len(self.channel_id) == 0:
- self.execute_next_action()
+ self.execute_next_action(actions=actions)
return
self.channel_obj = self.test_object.get_channel_object(self.channel_id)
@@ -598,23 +600,23 @@
# names
if (self.channel_obj.app_channel in event['channel']
or self.channel_obj.controller_channel in event['channel']):
- self.execute_next_action()
-
- def execute_next_action(self, result=None):
+ self.execute_next_action(actions=actions)
+
+ def execute_next_action(self, result=None, actions=None):
"""Execute the next action in the sequence"""
- if (len(self.actions) == 0):
+ if (not actions or len(actions) == 0):
return
LOGGER.debug("Executing action %d on %s" %
(self.__current_action, str(self.channel_obj)))
- ret_obj = self.actions.pop(0)(self.channel_obj)
+ ret_obj = actions.pop(0)(self.channel_obj)
self.__current_action += 1
if ret_obj is not None:
- ret_obj.addCallback(self.execute_next_action)
+ ret_obj.addCallback(self.execute_next_action, actions)
else:
- reactor.callLater(0, self.execute_next_action)
+ reactor.callLater(0, self.execute_next_action, actions)
return result
def dispose(self, ami):
Added: asterisk/trunk/tests/apps/authenticate/off_nominal/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/authenticate/off_nominal/configs/ast1/extensions.conf?view=auto&rev=5449
==============================================================================
--- asterisk/trunk/tests/apps/authenticate/off_nominal/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/apps/authenticate/off_nominal/configs/ast1/extensions.conf Thu Aug 14 16:12:22 2014
@@ -1,0 +1,21 @@
+[default]
+exten => sendDTMF,1,NoOp()
+ same => n,Verbose(1, Sending DTMF Signal ${DTMF_TO_SEND})
+ same => n,SendDTMF(${DTMF_TO_SEND})
+ same => n,Goto(default,wait,1)
+
+exten => wait,1,NoOp()
+ same => n,Wait(2)
+
+exten => hangup,1,NoOp()
+ same => n,Verbose(1, Hanging up)
+ same => n,Hangup()
+
+; ----------------------------------------------------------------------
+; The main test extension.
+; ----------------------------------------------------------------------
+
+exten => start,1,NoOp()
+ same => n,Answer()
+ same => n,Authenticate(5309)
+ same => n,Hangup()
Propchange: asterisk/trunk/tests/apps/authenticate/off_nominal/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/apps/authenticate/off_nominal/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/apps/authenticate/off_nominal/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/apps/authenticate/off_nominal/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/authenticate/off_nominal/test-config.yaml?view=auto&rev=5449
==============================================================================
--- asterisk/trunk/tests/apps/authenticate/off_nominal/test-config.yaml (added)
+++ asterisk/trunk/tests/apps/authenticate/off_nominal/test-config.yaml Thu Aug 14 16:12:22 2014
@@ -1,0 +1,74 @@
+test-info:
+ summary: Tests the failure reponse of the Authenticate application with a custom prompt.
+ description: |
+ This test will originate a local channel, and when the channel is detected,
+ the Authenticate application will be called through the dialplan. An incorrect
+ dtmf password will be provided, and the test will pass as long as the Authenticate
+ application fails correctly, by playing 'auth-incorrect' until the max number of
+ tries is exceeded, and then it will play 'vm-goodbye' and hang up the channel.
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'apptest.AppTest'
+
+test-object-config:
+ apps:
+ - 'Authenticate'
+ scenarios:
+ -
+ channels:
+ -
+ channel-id: 'Authenticate-Channel'
+ channel-name: 'Local/start at default'
+ context: 'default'
+ exten: 'wait'
+ start-on-create: True
+ events:
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'Newexten'
+ Application: 'Authenticate'
+ actions:
+ -
+ action-type: 'send-dtmf'
+ dtmf: '0112#'
+ -
+ type: 'headermatch'
+ count: 2
+ conditions:
+ match:
+ Event: 'TestEvent'
+ State: 'PLAYBACK'
+ Channel: 'Local/start at default-.*'
+ Message: 'auth-incorrect'
+ actions:
+ -
+ action-type: 'send-dtmf'
+ dtmf: '3581#'
+
+ -
+ type: 'headermatch'
+ count: 1
+ conditions:
+ match:
+ Event: 'TestEvent'
+ State: 'PLAYBACK'
+ Channel: 'Local/start at default-.*'
+ Message: 'vm-goodbye'
+ actions:
+ -
+ action-type: 'end-scenario'
+
+properties:
+ minversion: '1.8.0.0'
+ dependencies:
+ - buildoption: 'TEST_FRAMEWORK'
+ - python : 'twisted'
+ - python : 'starpy'
+ - asterisk : 'app_senddtmf'
+ - asterisk : 'app_authenticate'
+ tags:
+ - apps
Propchange: asterisk/trunk/tests/apps/authenticate/off_nominal/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/apps/authenticate/off_nominal/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/apps/authenticate/off_nominal/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/apps/authenticate/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/authenticate/tests.yaml?view=auto&rev=5449
==============================================================================
--- asterisk/trunk/tests/apps/authenticate/tests.yaml (added)
+++ asterisk/trunk/tests/apps/authenticate/tests.yaml Thu Aug 14 16:12:22 2014
@@ -1,0 +1,3 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+ - test: 'off_nominal'
Propchange: asterisk/trunk/tests/apps/authenticate/tests.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/apps/authenticate/tests.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/apps/authenticate/tests.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: asterisk/trunk/tests/apps/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/tests.yaml?view=diff&rev=5449&r1=5448&r2=5449
==============================================================================
--- asterisk/trunk/tests/apps/tests.yaml (original)
+++ asterisk/trunk/tests/apps/tests.yaml Thu Aug 14 16:12:22 2014
@@ -19,3 +19,4 @@
- test: 'say_interrupt'
- test: 'channel_redirect'
- dir: 'disa'
+ - dir: 'authenticate'
More information about the svn-commits
mailing list