[Asterisk-code-review] tests/apps/voicemail: Speed up tests (testsuite[master])

Richard Mudgett asteriskteam at digium.com
Fri Jul 21 16:17:49 CDT 2017


Richard Mudgett has uploaded this change for review. ( https://gerrit.asterisk.org/6064


Change subject: tests/apps/voicemail: Speed up tests
......................................................................

tests/apps/voicemail: Speed up tests

apps/voicemail/authenticate_extensions:
apps/voicemail/authenticate_invalid_mailbox:
apps/voicemail/authenticate_invalid_password:
apps/voicemail/authenticate_nominal:

Put '#' at end of mailbox and password to shave off time from the test
time.  The '#' tells voicemail we are done sending digits so it doesn't
have to wait two seconds for each prompt for more digits that are not
coming.

Change-Id: Ia34abf359f018cce3e5de4c075f241bc9e5b5767
---
M tests/apps/voicemail/authenticate_extensions/run-test
M tests/apps/voicemail/authenticate_invalid_mailbox/run-test
M tests/apps/voicemail/authenticate_invalid_password/run-test
M tests/apps/voicemail/authenticate_nominal/run-test
4 files changed, 30 insertions(+), 19 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/64/6064/1

diff --git a/tests/apps/voicemail/authenticate_extensions/run-test b/tests/apps/voicemail/authenticate_extensions/run-test
index 7f02556..602da32 100755
--- a/tests/apps/voicemail/authenticate_extensions/run-test
+++ b/tests/apps/voicemail/authenticate_extensions/run-test
@@ -35,14 +35,14 @@
         if state == 'PLAYBACK':
             message = event.get('message')
             if message == 'vm-login':
-                self.voice_mail_test.send_dtmf("1234")
+                self.voice_mail_test.send_dtmf("1234#")
+                self.voice_mail_test.reset_timeout()
             elif message == 'vm-password':
                 """
                 Instead of sending a password, ask to be transferred to the
                 attendant extension
                 """
-                self.voice_mail_test.send_dtmf("*")
-                self.voice_mail_test.reset_timeout()
+                self.voice_mail_test.send_dtmf("*#")
             elif message == 'vm-incorrect-mailbox':
                 logger.warn("We failed to pass a valid mailbox - failing the test")
                 self.voice_mail_test.passed = False
@@ -74,7 +74,7 @@
             message = event.get('message')
             if message == 'vm-login':
                 """ Don't login - just ask to be transferred """
-                self.voice_mail_test.send_dtmf("*")
+                self.voice_mail_test.send_dtmf("*#")
                 self.voice_mail_test.reset_timeout()
             elif message == 'vm-password':
                 logger.warn("We were asked a password instead of being transferred - failing the test")
diff --git a/tests/apps/voicemail/authenticate_invalid_mailbox/run-test b/tests/apps/voicemail/authenticate_invalid_mailbox/run-test
index 6b9a6ac..17095be 100755
--- a/tests/apps/voicemail/authenticate_invalid_mailbox/run-test
+++ b/tests/apps/voicemail/authenticate_invalid_mailbox/run-test
@@ -36,14 +36,15 @@
         if state == 'PLAYBACK':
             message = event.get('message')
             if message == 'vm-login' or message == 'vm-incorrect-mailbox':
-                self.voice_mail_test.send_dtmf("5555")
+                self.voice_mail_test.send_dtmf("5678#")
                 self.voice_mail_test.reset_timeout()
                 self.login_attempts += 1
-                if (self.login_attempts == 3):
-                    logger.info("Failed to login 3 times - setting test result to Pass")
-                    self.voice_mail_test.passed = True
             elif message == 'vm-password':
-                self.voice_mail_test.send_dtmf("1234")
+                self.voice_mail_test.send_dtmf("1234#")
+            elif message == 'vm-incorrect':
+                if (self.login_attempts == 3):
+                    logger.info("Good, mailbox and password didn't login after 3 tries")
+                    self.voice_mail_test.passed = True
             elif message == 'vm-goodbye':
                 self.voice_mail_test.hangup()
             else:
diff --git a/tests/apps/voicemail/authenticate_invalid_password/run-test b/tests/apps/voicemail/authenticate_invalid_password/run-test
index a8951c3..ec389b9 100755
--- a/tests/apps/voicemail/authenticate_invalid_password/run-test
+++ b/tests/apps/voicemail/authenticate_invalid_password/run-test
@@ -29,22 +29,27 @@
 
     def __init__(self, controller, voiceMailTest):
         VoiceMailState.__init__(self, controller, voiceMailTest)
+        self.login_attempts = 0
 
     def handle_state_change(self, ami, event):
         state = event['state']
         if state == 'PLAYBACK':
             message = event.get('message')
             if message == 'vm-login' or message == 'vm-incorrect-mailbox':
-                self.voice_mail_test.send_dtmf("1234")
-            elif message == 'vm-password':
-                self.voice_mail_test.send_dtmf("5555")
+                self.voice_mail_test.send_dtmf("1234#")
                 self.voice_mail_test.reset_timeout()
+                self.login_attempts += 1
+            elif message == 'vm-password':
+                self.voice_mail_test.send_dtmf("5555#")
+            elif message == 'vm-incorrect':
+                if (self.login_attempts == 3):
+                    logger.info("Good, mailbox and password didn't login after 3 tries")
             elif message == 'vm-goodbye':
                 self.voice_mail_test.hangup()
             else:
                 self.handle_default_state(event)
         elif state == 'AUTHENTICATED':
-            logger.warn("We authenticated with an invalid mailbox - failing the test")
+            logger.warn("We authenticated with an invalid password - failing the test")
             self.voice_mail_test.passed = False
             self.voice_mail_test.stop_reactor()
         else:
@@ -61,20 +66,25 @@
 
     def __init__(self, controller, voiceMailTest):
         VoiceMailState.__init__(self, controller, voiceMailTest)
+        self.login_attempts = 0
 
     def handle_state_change(self, ami, event):
         state = event['state']
         if state == 'PLAYBACK':
             message = event.get('message')
             if message == 'vm-password':
-                self.voice_mail_test.send_dtmf("5555")
+                self.voice_mail_test.send_dtmf("5555#")
                 self.voice_mail_test.reset_timeout()
+                self.login_attempts += 1
+            elif message == 'vm-incorrect':
+                if (self.login_attempts == 3):
+                    logger.info("Good, just password didn't login after 3 tries")
             elif message == 'vm-goodbye':
                 self.voice_mail_test.hangup()
             else:
                 self.handle_default_state(event)
         elif state == 'AUTHENTICATED':
-            logger.warn("We authenticated with an invalid mailbox - failing the test")
+            logger.warn("We authenticated with an invalid password - failing the test")
             self.voice_mail_test.passed = False
             self.voice_mail_test.stop_reactor()
         else:
diff --git a/tests/apps/voicemail/authenticate_nominal/run-test b/tests/apps/voicemail/authenticate_nominal/run-test
index dba79da..49b182f 100755
--- a/tests/apps/voicemail/authenticate_nominal/run-test
+++ b/tests/apps/voicemail/authenticate_nominal/run-test
@@ -37,10 +37,10 @@
         if state == 'PLAYBACK':
             message = event.get('message')
             if message == 'vm-login':
-                self.voice_mail_test.send_dtmf(self.mailbox)
-            elif message == 'vm-password':
-                self.voice_mail_test.send_dtmf(self.password)
+                self.voice_mail_test.send_dtmf(self.mailbox + "#")
                 self.voice_mail_test.reset_timeout()
+            elif message == 'vm-password':
+                self.voice_mail_test.send_dtmf(self.password + "#")
             elif message == 'vm-incorrect-mailbox':
                 logger.warn("Failed to authenticate properly, failing test")
                 self.voice_mail_test.passed = False
@@ -74,7 +74,7 @@
         if state == 'PLAYBACK':
             message = event.get('message')
             if message == 'vm-password':
-                self.voice_mail_test.send_dtmf(self.password)
+                self.voice_mail_test.send_dtmf(self.password + "#")
                 self.voice_mail_test.reset_timeout()
             elif message == 'vm-incorrect-mailbox' or message == 'vm-incorrect':
                 logger.warn("Failed to authenticate properly, failing test")

-- 
To view, visit https://gerrit.asterisk.org/6064
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia34abf359f018cce3e5de4c075f241bc9e5b5767
Gerrit-Change-Number: 6064
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170721/601b990a/attachment.html>


More information about the asterisk-code-review mailing list