[Asterisk-code-review] Testsuite: Fix SIP device state test ... again. (testsuite[master])

Anonymous Coward asteriskteam at digium.com
Fri Jun 17 13:32:25 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: Testsuite: Fix SIP device state test ... again.
......................................................................


Testsuite: Fix SIP device state test ... again.

The previous fix to this test changed the timing of originations to be
when DeviceStateChange events were received. This works great as long as
the version of Asterisk being tested has that event. Asterisk versions
prior to 13 do not have this event.

The fix is to key off an event that is common to all versions of
Asterisk: ExtensionStatus. The logger message isn't as useful as it was
with DeviceStateChange, but the test now passes with all current
versions of Asterisk.

Change-Id: I040efcb4a2e64aa7e31143dbd626bb964f1a4025
---
M tests/channels/SIP/device_state_notification/originator.py
1 file changed, 4 insertions(+), 4 deletions(-)

Approvals:
  Scott Griepentrog: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/tests/channels/SIP/device_state_notification/originator.py b/tests/channels/SIP/device_state_notification/originator.py
index 0b2b171..b349dc6 100644
--- a/tests/channels/SIP/device_state_notification/originator.py
+++ b/tests/channels/SIP/device_state_notification/originator.py
@@ -32,14 +32,14 @@
     def ami_connect(self, ami):
         LOGGER.info("AMI connected")
         self.ami = ami
-        self.ami.registerEvent('DeviceStateChange', self.device_state_change)
+        self.ami.registerEvent('ExtensionStatus', self.extension_status)
         return
 
-    def device_state_change(self, ami, event):
-        if event['device'] != 'Custom:Eggs':
+    def extension_status(self, ami, event):
+        if event['hint'] != 'Custom:Eggs':
             return
 
-        LOGGER.info("Device state changed to {0}".format(event['state']))
+        LOGGER.info("Extension state changed to {0}".format(event['status']))
         self.current_destination += 1
         if self.current_destination < len(DESTINATIONS):
             self.originate_call()

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I040efcb4a2e64aa7e31143dbd626bb964f1a4025
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Scott Griepentrog <sgriepentrog at digium.com>



More information about the asterisk-code-review mailing list