[asterisk-commits] Testsuite: Update the ARIRequest class to support checking a... (testsuite[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 9 07:40:53 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: Testsuite: Update the ARIRequest class to support checking a response body
......................................................................


Testsuite: Update the ARIRequest class to support checking a response body

Added a yaml configuration response body parameter that checks to match
whether or not the received response body matches that of the given response
body that is specified in the yaml.

ASTERISK-25173
Reported By: Matt Jordan

Change-Id: I75edf26e21fa4da01b4a66670b475ac271d086fb
---
M lib/python/asterisk/ari.py
1 file changed, 5 insertions(+), 0 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Matt Jordan: Looks good to me, approved; Verified
  Ashley Sanders: Looks good to me, but someone else must approve



diff --git a/lib/python/asterisk/ari.py b/lib/python/asterisk/ari.py
index 50c29fe..bae13da 100644
--- a/lib/python/asterisk/ari.py
+++ b/lib/python/asterisk/ari.py
@@ -511,6 +511,7 @@
         self.ari = ari
         self.method = config['method']
         self.uri = config['uri']
+        self.response_body = config.get('response_body')
         self.params = config.get('params') or {}
         self.body = config.get('body')
         self.instance = config.get('instance')
@@ -537,6 +538,10 @@
             headers=self.headers,
             auth=self.ari.userpass)
 
+        if self.response_body:
+            match = self.response_body.get('match')
+            return all_match(match, response.json())
+
         if self.expect:
             if response.status_code != self.expect:
                 LOGGER.error('sent %s %s %s expected %s response %d %s',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I75edf26e21fa4da01b4a66670b475ac271d086fb
Gerrit-PatchSet: 7
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Scott Emidy <jemidy at digium.com>
Gerrit-Reviewer: Ashley Sanders <asanders at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list