[Asterisk-code-review] testsuite: Fix event checking for poll_sub_unsub test. (...testsuite[13])

Benjamin Keith Ford asteriskteam at digium.com
Tue Apr 30 11:25:46 CDT 2019


Benjamin Keith Ford has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/11323


Change subject: testsuite: Fix event checking for poll_sub_unsub test.
......................................................................

testsuite: Fix event checking for poll_sub_unsub test.

Initially, this test checked the ContactStatus event to trigger the rest
of the events for the test. This was fine for 13, but the values in the
event are different in 16 and master, causing the test to fail on those
versions. This changes the test to check for the
AOR_CONTACT_ADDED/REMOVED TestEvents, and verify the contact field on
that event instead.

Change-Id: Ia8f851874a9517ad7466f67937e1b83c1c11e577
---
M tests/apps/voicemail/polling/poll_sub_unsub/run-test
1 file changed, 9 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/23/11323/1

diff --git a/tests/apps/voicemail/polling/poll_sub_unsub/run-test b/tests/apps/voicemail/polling/poll_sub_unsub/run-test
index c77827e..896e3a2 100755
--- a/tests/apps/voicemail/polling/poll_sub_unsub/run-test
+++ b/tests/apps/voicemail/polling/poll_sub_unsub/run-test
@@ -72,21 +72,24 @@
         if "Local/playback at default" in event.get("channel"):
             self.stop_test(True)
 
-    def handle_contact_status(self, ami, event):
+    def handle_test_event(self, ami, event):
 
-        if event.get("aor") != "1234":
+        state = event.get("state")
+
+        if state != "AOR_CONTACT_ADDED" and state != "AOR_CONTACT_REMOVED":
             return
 
-        status = event.get("contactstatus")
+        if event.get("contact") != "sip:1234 at 127.0.0.2:5061":
+            return
 
-        if status == "Created":
+        if state == "AOR_CONTACT_ADDED":
             self.voicemailManager = VoiceMailMailboxManagement(self.ast[0])
             self.voicemailManager.create_mailbox("default", "1234", True)
             formats = ["ulaw"]
             if not self.voicemailManager.create_dummy_voicemail("default", "1234", VoiceMailMailboxManagement.inbox_folder_name, 1, formats):
                 LOGGER.error("Failed to create voicemail")
                 self.stop_test()
-        elif status == "Removed":
+        elif state == "AOR_CONTACT_REMOVED":
             # Remove the voicemail from the mailbox
             self.voicemailManager.remove_mailbox("default", "1234")
             
@@ -101,7 +104,7 @@
 
     def ami_connect(self, ami):
 
-        ami.registerEvent("ContactStatus", self.handle_contact_status)
+        ami.registerEvent("TestEvent", self.handle_test_event)
         ami.registerEvent("MessageWaiting", self.handle_message_waiting)
         ami.registerEvent("Hangup", self.handle_hangup)
 

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/11323
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 13
Gerrit-Change-Id: Ia8f851874a9517ad7466f67937e1b83c1c11e577
Gerrit-Change-Number: 11323
Gerrit-PatchSet: 1
Gerrit-Owner: Benjamin Keith Ford <bford at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190430/7cf7e55e/attachment.html>


More information about the asterisk-code-review mailing list