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

Friendly Automation asteriskteam at digium.com
Wed May 1 07:01:37 CDT 2019


Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/testsuite/+/11324 )

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, 10 insertions(+), 7 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/tests/apps/voicemail/polling/poll_sub_unsub/run-test b/tests/apps/voicemail/polling/poll_sub_unsub/run-test
index c77827e..30dd98e 100755
--- a/tests/apps/voicemail/polling/poll_sub_unsub/run-test
+++ b/tests/apps/voicemail/polling/poll_sub_unsub/run-test
@@ -72,24 +72,27 @@
         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")
-            
+
             # Originate a channel that will end the test on hangup
             variable = {}
             ami.originate(channel="Local/playback at default",
@@ -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/+/11324
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 16
Gerrit-Change-Id: Ia8f851874a9517ad7466f67937e1b83c1c11e577
Gerrit-Change-Number: 11324
Gerrit-PatchSet: 1
Gerrit-Owner: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190501/e4e05675/attachment.html>


More information about the asterisk-code-review mailing list