[asterisk-commits] mjordan: testsuite/asterisk/trunk r2300 - in /asterisk/trunk/tests/apps/voice...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 16 10:02:21 CDT 2011


Author: mjordan
Date: Fri Sep 16 10:02:19 2011
New Revision: 2300

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=2300
Log:
Addition of leave_voicemail tests.  

These tests check various options for leaving a voicemail.

Added:
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_contexts/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/configs/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_contexts/configs/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/configs/ast1/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_contexts/configs/ast1/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/configs/ast1/extensions.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_contexts/configs/ast1/extensions.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/configs/ast1/sip.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_contexts/configs/ast1/sip.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/configs/ast1/voicemail.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_contexts/configs/ast1/voicemail.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/configs/ast2/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_contexts/configs/ast2/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/configs/ast2/extensions.conf
      - copied, changed from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_contexts/configs/ast2/extensions.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/configs/ast2/sip.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_contexts/configs/ast2/sip.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/run-test
      - copied, changed from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_contexts/run-test
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/test-config.yaml
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_contexts/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_external_notification/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/configs/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_external_notification/configs/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast1/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast1/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast1/extensions.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast1/extensions.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast1/sip.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast1/sip.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast1/voicemail.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast1/voicemail.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast2/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast2/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast2/extensions.conf
      - copied, changed from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast2/extensions.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast2/sip.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast2/sip.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/extern-notify-script.py
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_external_notification/extern-notify-script.py
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/run-test
      - copied, changed from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_external_notification/run-test
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/test-config.yaml
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_external_notification/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding/configs/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding/configs/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding/configs/ast1/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding/configs/ast1/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding/configs/ast1/extensions.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding/configs/ast1/extensions.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding/configs/ast1/sip.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding/configs/ast1/sip.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding/configs/ast1/voicemail.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding/configs/ast1/voicemail.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding/configs/ast2/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding/configs/ast2/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding/configs/ast2/extensions.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding/configs/ast2/extensions.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding/configs/ast2/sip.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding/configs/ast2/sip.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding/run-test
      - copied, changed from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding/run-test
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding/test-config.yaml
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/configs/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/configs/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/configs/ast1/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/configs/ast1/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/configs/ast1/extensions.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/configs/ast1/extensions.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/configs/ast1/sip.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/configs/ast1/sip.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/configs/ast1/voicemail.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/configs/ast1/voicemail.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/configs/ast2/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/configs/ast2/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/configs/ast2/extensions.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/configs/ast2/extensions.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/configs/ast2/sip.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/configs/ast2/sip.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/run-test
      - copied, changed from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/run-test
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/test-config.yaml
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/test-config.yaml
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_priority/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_priority/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_priority/configs/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_priority/configs/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_priority/configs/ast1/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_priority/configs/ast1/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_priority/configs/ast1/extensions.conf
      - copied, changed from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_priority/configs/ast1/extensions.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_priority/configs/ast1/sip.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_priority/configs/ast1/sip.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_priority/configs/ast1/voicemail.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_priority/configs/ast1/voicemail.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_priority/configs/ast2/
      - copied from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_priority/configs/ast2/
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_priority/configs/ast2/extensions.conf
      - copied, changed from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_priority/configs/ast2/extensions.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_priority/configs/ast2/sip.conf
      - copied unchanged from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_priority/configs/ast2/sip.conf
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_priority/run-test
      - copied, changed from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_priority/run-test
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_priority/test-config.yaml
      - copied, changed from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_priority/test-config.yaml

Copied: asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/configs/ast2/extensions.conf (from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_contexts/configs/ast2/extensions.conf)
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/configs/ast2/extensions.conf?view=diff&rev=2300&p1=asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_contexts/configs/ast2/extensions.conf&r1=2091&p2=asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/configs/ast2/extensions.conf&r2=2300
==============================================================================
--- asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_contexts/configs/ast2/extensions.conf (original)
+++ asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/configs/ast2/extensions.conf Fri Sep 16 10:02:19 2011
@@ -5,8 +5,7 @@
     same => n,Wait(3)
     same => n,Verbose(1, Sending ${DTMF_TO_SEND} key)
     same => n,SendDTMF(${DTMF_TO_SEND})
-    same => n,UserEvent(TestResult,result: spawn,status: spawn next test)
-    same => n,Wait(10)
+    same => n,Wait(2)
     same => n,Hangup()
 
 exten => 9000,1,NoOp()
@@ -15,6 +14,5 @@
     same => n,Playback(${TALK_AUDIO})
     same => n,Verbose(1, Sending ${DTMF_TO_SEND} key)
     same => n,SendDTMF(${DTMF_TO_SEND})
-    same => n,UserEvent(TestResult,result: spawn,status: spawn next test)
-    same => n,Wait(20)
+    same => n,Wait(2)
     same => n,Hangup()

Copied: asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/run-test (from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_contexts/run-test)
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/run-test?view=diff&rev=2300&p1=asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_contexts/run-test&r1=2091&p2=asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/run-test&r2=2300
==============================================================================
--- asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_contexts/run-test (original)
+++ asterisk/trunk/tests/apps/voicemail/leave_voicemail_contexts/run-test Fri Sep 16 10:02:19 2011
@@ -34,34 +34,14 @@
     """
     executed = []
 
-    """
-    Number of asterisk instances to create
-    """
-    ast_instances = 2
-
-    """
-    which iteration of the test we're executing.  Each iteration will attempt to leave the voicemail
-    in a different context.
-    """
-    testCounter = 0
-
-    """
-    The expected values we should get back from each test
-    """
-    expectedValues = {'attendant': False, 'operator': False, 'othercontext at 1': False, 'othercontext at 3': False, 'othercontext at operator': False}
-
     def __init__(self):
         super(LeaveVoicemailContexts, self).__init__()
 
-        i = 0
-        while (i < self.ast_instances):
-            self.executed.append(False)
-            i = i + 1
-
         self.reactor_timeout = 60
-
-        self.create_asterisk(self.ast_instances)
-
+        self.testCounter = 0
+        self.create_asterisk(2)
+        self.expectedValues = {'attendant': False, 'operator': False, 'othercontext at 1': False, 'othercontext at 3': False, 'othercontext at operator': False}
+        self.senderAmi = None
 
     def ami_connect(self, ami):
         super(LeaveVoicemailContexts, self).ami_connect(ami)
@@ -75,89 +55,83 @@
 
         logger.debug("AMI ID: " + str(ami.id))
         logger.debug("Executed: " + str(self.executed[ami.id]))
-        if ((ami.id != 0) and (self.executed[ami.id] == False)):
+        if (ami.id != 0):
+            self.senderAmi = ami
+            LeaveVoicemailContexts.executeTest(self)
 
-            LeaveVoicemailContexts.executeTest(self, ami)
-            self.executed[ami.id] = True
 
-    def executeTest(self, ami):
+    def executeTest(self):
         logger.info("Executing test [" + str(self.testCounter) + "]")
         if self.testCounter == 0:
             """
             Test exiting out before leaving voicemail and going to operator extension
             """
-            self.ast[ami.id].cli_exec("dialplan set global DTMF_TO_SEND 0")
-            df = ami.originate("sip/ast1/1234", "sendvoicemail", "1234", 1)
+            self.ast[self.senderAmi.id].cli_exec("dialplan set global DTMF_TO_SEND 0")
+            df = self.senderAmi.originate("sip/ast1/1234", "sendvoicemail", "1234", 1)
             df.addErrback(self.handleOriginateFailure)
         elif self.testCounter == 1:
             """
             Test exiting out before leaving voicemail and going to asterisk (a) extension
             """
-            self.ast[ami.id].cli_exec("dialplan set global DTMF_TO_SEND *")
-            df = ami.originate("sip/ast1/1234", "sendvoicemail", "1234", 1)
+            self.ast[self.senderAmi.id].cli_exec("dialplan set global DTMF_TO_SEND *")
+            df = self.senderAmi.originate("sip/ast1/1234", "sendvoicemail", "1234", 1)
             df.addErrback(self.handleOriginateFailure)
         elif self.testCounter == 2:
             """
             Test exiting out before leaving voicemail and going to numeric 1 extension
             """
-            self.ast[ami.id].cli_exec("dialplan set global DTMF_TO_SEND 1")
-            df = ami.originate("sip/ast1/1234", "sendvoicemail", "1234", 1)
+            self.ast[self.senderAmi.id].cli_exec("dialplan set global DTMF_TO_SEND 1")
+            df = self.senderAmi.originate("sip/ast1/1234", "sendvoicemail", "1234", 1)
             df.addErrback(self.handleOriginateFailure)
         elif self.testCounter == 3:
             """
             Test exiting out before leaving voicemail and going to numeric 3 extension
             """
-            self.ast[ami.id].cli_exec("dialplan set global DTMF_TO_SEND 3")
-            df = ami.originate("sip/ast1/5678", "sendvoicemail", "5678", 1)
+            self.ast[self.senderAmi.id].cli_exec("dialplan set global DTMF_TO_SEND 3")
+            df = self.senderAmi.originate("sip/ast1/5678", "sendvoicemail", "5678", 1)
             df.addErrback(self.handleOriginateFailure)
         elif self.testCounter == 4:
             """
             Test exiting out before leaving voicemail and going to operator extension in a different context
             """
-            self.ast[ami.id].cli_exec("dialplan set global DTMF_TO_SEND 0")
-            df = ami.originate("sip/ast1/9000", "sendvoicemail", "9000", 1)
+            self.ast[self.senderAmi.id].cli_exec("dialplan set global DTMF_TO_SEND 0")
+            df = self.senderAmi.originate("sip/ast1/9000", "sendvoicemail", "9000", 1)
             df.addErrback(self.handleOriginateFailure)
         else:
             logger.warn("Test iterated [" + str(self.testCounter) + "] - expected less than 5")
 
-        self.testCounter = self.testCounter + 1
+        self.testCounter +=1
 
     def user_event(self, ami, event):
 
         if event['userevent'] != 'TestResult':
             return
 
-        if ami.id == 0:
-            if event['result'] != 'fail':
-                logger.info("Received non-failure result " + event['result'])
-                if event['result'] in self.expectedValues:
-                    self.expectedValues[event['result']] = True
-                    self.passed = True
-                else:
-                    logger.warn("Unsupported or unexpected result: " + event['result'])
+        if event['result'] != 'fail':
+            logger.info("Received non-failure result " + event['result'])
+            if event['result'] in self.expectedValues:
+                self.expectedValues[event['result']] = True
+                self.passed = True
             else:
-                logger.warn("VoiceMail did not successfully exit:")
-                logger.warn("result: %s" % (event['result'],))
-                logger.warn("error: %s" % (event['status'],))
-                self.passed = False
+                logger.warn("Unsupported or unexpected result: " + event['result'])
+        else:
+            logger.warn("VoiceMail did not successfully exit:")
+            logger.warn("result: %s" % (event['result'],))
+            logger.warn("error: %s" % (event['status'],))
+            self.passed = False
 
-            if self.testCounter == 5:
-                self.stop_reactor()
-
-        elif ami.id == 1:
-            """
-            Here we don't care about pass / fail - the UserEvent simply tells us to execute another test
-            """
+        if self.testCounter == 5:
+            self.stop_reactor()
+        else:
             logger.debug("AMI ID is 1; testCounter is " + str(self.testCounter) + " - attempting to execute next test")
-            if self.testCounter < 5:
-                self.executeTest(ami)
+            self.executeTest()
 
     def run(self):
         super(LeaveVoicemailContexts, self).run()
 
         """ Create the AMI factories
         """
-        self.create_ami_factory(self.ast_instances)
+        self.create_ami_factory(2)
 
 
 def main():

Copied: asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast2/extensions.conf (from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast2/extensions.conf)
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast2/extensions.conf?view=diff&rev=2300&p1=asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast2/extensions.conf&r1=2091&p2=asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast2/extensions.conf&r2=2300
==============================================================================
--- asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast2/extensions.conf (original)
+++ asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/configs/ast2/extensions.conf Fri Sep 16 10:02:19 2011
@@ -6,6 +6,5 @@
     same => n,Verbose(1, Playing back ${TALK_AUDIO})
     same => n,Playback(${TALK_AUDIO})
     same => n,SendDTMF(#)
-    same => n,UserEvent(TestResult,result: nextTest, status: Execute next test step)
-    same => n,Wait(3)
+    same => n,Wait(2)
     same => n,Hangup()

Copied: asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/run-test (from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_external_notification/run-test)
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/run-test?view=diff&rev=2300&p1=asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_external_notification/run-test&r1=2091&p2=asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/run-test&r2=2300
==============================================================================
--- asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_external_notification/run-test (original)
+++ asterisk/trunk/tests/apps/voicemail/leave_voicemail_external_notification/run-test Fri Sep 16 10:02:19 2011
@@ -30,64 +30,28 @@
     """
     testParentDir = "tests/apps/voicemail"
 
-    """
-    Tracks each AMI connection to see if we've received it an executed our dialplan functions
-    """
-    executed = []
-
-    """
-    Number of asterisk instances to create
-    """
-    ast_instances = 2
-
-    """
-    Test loop counter
-    """
-    testCounter = 0
-
-    """
-    The expected values we should get back from each test
-    """
-    expectedValues = {'1234': False, '9000': False, '9001': False, '9002': False, '9003': False}
-
-    """
-    The number of received user responses that have come back from ast1
-    """
-    ast1UserResponses = 0
-
     def __init__(self):
         super(LeaveVoicemailExternNotify, self).__init__()
 
-        i = 0
-        while (i < self.ast_instances):
-            self.executed.append(False)
-            i = i + 1
-
-        """
-        This test is this long.  60 seconds will usually truncate the last test
-        """
         self.reactor_timeout = 90
-
+        self.testCounter = 0
+        self.expectedValues = {'1234': False, '9000': False, '9001': False, '9002': False, '9003': False}
         self.create_asterisk(self.ast_instances)
-
+        self.senderAmi = None
 
     def ami_connect(self, ami):
         super(LeaveVoicemailExternNotify, self).ami_connect(ami)
 
         self.audioFile = os.path.join(os.getcwd(), "%s/sounds/talking" % (self.testParentDir))
-
         ami.registerEvent('UserEvent', self.user_event)
 
-        if ((ami.id != 0) and (self.executed[ami.id] == False)):
-            self.executed[ami.id] = True
+        if (ami.id != 0):
             self.ast[ami.id].cli_exec("dialplan set global TALK_AUDIO " + self.audioFile)
-
-            self.executeTest(ami)
+            self.senderAmi = ami
+            self.executeTest()
 
     def validateMail1234(self, filePath):
-
         expectedMailTokens = {'From': False, 'To': False, 'Subject': False, 'Body': False, 'Attachment': False}
-
         for line in open(filePath, 'r'):
             if "From: \"Asterisk\"" in line:
                 expectedMailTokens['From'] = True
@@ -104,14 +68,10 @@
             if not v:
                 logger.warn("Failed to find token " + k + " in mailfile " + filePath)
                 return False
-
         return True
 
-
     def validateMail9000(self, filePath):
-
         expectedMailTokens = {'From': False, 'To': False, 'Subject': False, 'Body': False}
-
         for line in open(filePath):
             if "From: \"Asterisk\"" in line:
                 expectedMailTokens['From'] = True
@@ -126,14 +86,10 @@
             if not v:
                 logger.warn(" Failed to find token " + k + " in mailfile " + filePath)
                 return False
-
         return True
 
-
     def validateMail9001(self, filePath):
-
         expectedMailTokens = {'From': False, 'To': False, 'Subject': False, 'Body': False, 'Attachment': False}
-
         for line in open(filePath):
             if "From: \"Asterisk\"" in line:
                 expectedMailTokens['From'] = True
@@ -150,9 +106,7 @@
             if not v:
                 logger.warn("Failed to find token " + k + " in mailfile " + filePath)
                 return False
-
         return True
-
 
     def validateMail9002(self, filePath):
         """
@@ -164,11 +118,8 @@
         """
         return self.validateMail9001(filePath)
 
-
     def validateMail9003(self, filePath):
-
         expectedMailTokens = {'From': False, 'To': False, 'Subject': False, 'Body': False, 'Attachment': True}
-
         for line in open(filePath):
             if "From: \"Asterisk\" <test at test.com>" in line:
                 expectedMailTokens['From'] = True
@@ -188,38 +139,34 @@
             if not v:
                 logger.warn("Failed to find token " + k + " in mailfile " + filePath)
                 return False
-
         return True
 
-
-    def executeTest(self, ami):
+    def executeTest(self):
         if self.testCounter == 0:
             logger.debug("Executing test [" + str(self.testCounter) + "] - send to 1234")
-            df = ami.originate("sip/ast1/1234", "sendvoicemail", "1234", 1)
+            df = self.senderAmi.originate("sip/ast1/1234", "sendvoicemail", "1234", 1)
             df.addErrback(self.handleOriginateFailure)
         elif self.testCounter == 1:
             logger.debug("Executing test [" + str(self.testCounter) + "] - send to 9000")
-            df = ami.originate("sip/ast1/9000", "sendvoicemail", "1234", 1)
+            df = self.senderAmi.originate("sip/ast1/9000", "sendvoicemail", "1234", 1)
             df.addErrback(self.handleOriginateFailure)
         elif self.testCounter == 2:
             logger.debug("Executing test [" + str(self.testCounter) + "] - send to 9001")
-            df = ami.originate("sip/ast1/9001", "sendvoicemail", "1234", 1)
+            df = self.senderAmi.originate("sip/ast1/9001", "sendvoicemail", "1234", 1)
             df.addErrback(self.handleOriginateFailure)
         elif self.testCounter == 3:
             logger.debug("Executing test [" + str(self.testCounter) + "] - send to 9002")
-            df = ami.originate("sip/ast1/9002", "sendvoicemail", "1234", 1)
+            df = self.senderAmi.originate("sip/ast1/9002", "sendvoicemail", "1234", 1)
             df.addErrback(self.handleOriginateFailure)
         elif self.testCounter == 4:
             logger.debug("Executing test [" + str(self.testCounter) + "] - send to 9003")
-            df = ami.originate("sip/ast1/9003", "sendvoicemail", "1234", 1)
-            df.addErrback(self.handleOriginateFailure)
-
-        self.testCounter = self.testCounter + 1
-
+            df = self.senderAmi.originate("sip/ast1/9003", "sendvoicemail", "1234", 1)
+            df.addErrback(self.handleOriginateFailure)
+
+        self.testCounter += 1
 
     def validateTest(self, extension):
         logger.debug("Validating for extension: " + extension)
-
         """
         Verify the mail file
         """
@@ -289,38 +236,30 @@
             logger.error("Expected external file (created from externnotify script) not found: " + externFileName)
             self.expectedValues[extension] = False
 
-
     def user_event(self, ami, event):
 
         if event['userevent'] != 'TestResult':
             return
 
-        if (ami.id == 0):
-            if event['result'] != 'fail':
-                logger.info("Received non-failure result " + event['result'])
-                if event['result'] in self.expectedValues:
-                    self.expectedValues[event['result']] = True
-                    self.validateTest(event['result'])
-                else:
-                    logger.warn("Unsupported or unexpected result: " + event['result'])
+        if event['result'] != 'fail':
+            logger.info("Received non-failure result " + event['result'])
+            if event['result'] in self.expectedValues:
+                self.expectedValues[event['result']] = True
+                self.validateTest(event['result'])
             else:
-                self.passed = False
-                logger.warn("VoiceMail did not successfully exit:")
-                logger.warn("result: %s" % (event['result'],))
-                logger.warn("error: %s" % (event['status'],))
-
-            self.ast1UserResponses = self.ast1UserResponses + 1
-            if (self.ast1UserResponses == 5):
-                logger.info("Received all 5 responses; ending test")
-                self.stop_reactor()
-
-        elif (ami.id == 1):
-            if event['result'] == 'nextTest':
-                logger.debug("Executing next test: [" + str(self.testCounter) + "]")
-                self.executeTest(ami)
-            else:
-                logger.warn("Unsupported UserEvent received from AMI 1")
-
+                logger.warn("Unsupported or unexpected result: " + event['result'])
+        else:
+            self.passed = False
+            logger.warn("VoiceMail did not successfully exit:")
+            logger.warn("result: %s" % (event['result'],))
+            logger.warn("error: %s" % (event['status'],))
+
+        if (self.testCounter == 5):
+            logger.info("Received all 5 responses; ending test")
+            self.stop_reactor()
+        else:
+            logger.debug("Executing next test: [" + str(self.testCounter) + "]")
+            self.executeTest()
 
     def run(self):
         super(LeaveVoicemailExternNotify, self).run()

Copied: asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding/run-test (from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding/run-test)
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding/run-test?view=diff&rev=2300&p1=asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding/run-test&r1=2091&p2=asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding/run-test&r2=2300
==============================================================================
--- asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding/run-test (original)
+++ asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding/run-test Fri Sep 16 10:02:19 2011
@@ -29,31 +29,11 @@
     """
     testParentDir = "tests/apps/voicemail"
 
-    """
-    Tracks each AMI connection to see if we've received it an executed our dialplan functions
-    """
-    executed = []
-
-    """
-    Number of asterisk instances to create
-    """
-    ast_instances = 2
-
-    """
-    Which iteration of the test we're executing.  Each iteration will attempt to leave the voicemail
-    in a different context.
-    """
-    testCounter = 0
-
     def __init__(self):
         super(LeaveVoicemailForwarding, self).__init__()
 
-        i = 0
-        while (i < self.ast_instances):
-            self.executed.append(False)
-            i = i + 1
-
-        self.create_asterisk(self.ast_instances)
+        self.testCounter = 0
+        self.create_asterisk(2)
 
 
     def ami_connect(self, ami):
@@ -63,8 +43,7 @@
 
         ami.registerEvent('UserEvent', self.user_event)
 
-        if ((ami.id != 0) and (self.executed[ami.id] == False)):
-            self.executed[ami.id] = True
+        if (ami.id != 0):
             self.ast[ami.id].cli_exec("dialplan set global TALK_AUDIO " + self.audioFile)
 
             df1 = ami.originate("sip/ast1/1234", "sendvoicemail", "1234", 1)
@@ -78,28 +57,29 @@
         if event['userevent'] != 'TestResult':
             return
 
-        self.testCounter = self.testCounter + 1
+        self.testCounter += 1
 
         if event["result"] != "fail":
             logger.info("Received non-failure result " + event['result'])
-            self.passed = True
+            if self.testCounter == 2:
+                logger.info("Received all expected results; stopping Reactor")
+                self.passed = True
+                self.stop_reactor()
         else:
             self.passed = False
             logger.warn("VoiceMail did not successfully exit:")
             logger.warn("result: %s" % (event['result'],))
             logger.warn("expected: %s" % (expected))
             logger.warn("error: %s" % (event['error'],))
+            self.stop_reactor()
 
-        if self.testCounter == 2:
-            logger.info("Received all expected results; stopping Reactor")
-            self.stop_reactor()
 
     def run(self):
         super(LeaveVoicemailForwarding, self).run()
 
         """ Create the AMI factories
         """
-        self.create_ami_factory(self.ast_instances)
+        self.create_ami_factory(2)
 
 def main():
 

Copied: asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/run-test (from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/run-test)
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/run-test?view=diff&rev=2300&p1=asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/run-test&r1=2091&p2=asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/run-test&r2=2300
==============================================================================
--- asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/run-test (original)
+++ asterisk/trunk/tests/apps/voicemail/leave_voicemail_forwarding_auto_urgent/run-test Fri Sep 16 10:02:19 2011
@@ -30,25 +30,10 @@
     """
     testParentDir = "tests/apps/voicemail"
 
-    """
-    Tracks each AMI connection to see if we've received it an executed our dialplan functions
-    """
-    executed = []
-
-    """
-    Number of asterisk instances to create
-    """
-    ast_instances = 2
-
     def __init__(self):
         super(LeaveVoicemailForwardingAutoUrgent, self).__init__()
 
-        i = 0
-        while (i < self.ast_instances):
-            self.executed.append(False)
-            i = i + 1
-
-        self.create_asterisk(self.ast_instances)
+        self.create_asterisk(2)
 
 
     def ami_connect(self, ami):
@@ -58,8 +43,7 @@
 
         ami.registerEvent('UserEvent', self.user_event)
 
-        if ((ami.id != 0) and (self.executed[ami.id] == False)):
-            self.executed[ami.id] = True
+        if (ami.id != 0):
             self.ast[ami.id].cli_exec("dialplan set global TALK_AUDIO " + self.audioFile)
 
             df1 = ami.originate("sip/ast1/1234", "sendvoicemail", "1234", 1)
@@ -88,7 +72,7 @@
 
         """ Create the AMI factories
         """
-        self.create_ami_factory(self.ast_instances)
+        self.create_ami_factory(2)
 
 def main():
 

Copied: asterisk/trunk/tests/apps/voicemail/leave_voicemail_priority/configs/ast1/extensions.conf (from r2091, asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_priority/configs/ast1/extensions.conf)
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/voicemail/leave_voicemail_priority/configs/ast1/extensions.conf?view=diff&rev=2300&p1=asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_priority/configs/ast1/extensions.conf&r1=2091&p2=asterisk/trunk/tests/apps/voicemail/leave_voicemail_priority/configs/ast1/extensions.conf&r2=2300
==============================================================================
--- asterisk/team/mjordan/voicemail_tests_082811/tests/apps/voicemail/leave_voicemail_priority/configs/ast1/extensions.conf (original)
+++ asterisk/trunk/tests/apps/voicemail/leave_voicemail_priority/configs/ast1/extensions.conf Fri Sep 16 10:02:19 2011
@@ -23,23 +23,23 @@
     same => n,Hangup()
 
 exten => o,1,UserEvent(TestResult,result: fail,status: failed to exit successfully)
-same => n,Wait(2)
-same => n,Hangup()
+	same => n,Wait(2)
+	same => n,Hangup()
 
 exten => i,1,UserEvent(TestResult,result: fail,status: failed to exit successfully)

[... 138 lines stripped ...]



More information about the asterisk-commits mailing list