[Asterisk-code-review] Testsuite: Update the ARIRequest class to support checking a... (testsuite[master])

Scott Emidy asteriskteam at digium.com
Wed Jul 8 11:37:23 CDT 2015


Scott Emidy has uploaded a new change for review.

  https://gerrit.asterisk.org/815

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

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


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/15/815/3

diff --git a/lib/python/asterisk/ari.py b/lib/python/asterisk/ari.py
index 50c29fe..cb6293a 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,11 @@
             headers=self.headers,
             auth=self.ari.userpass)
 
+        if self.response_body:
+            match = self.response_body.get('match')
+            res = all_match(match, response.json())
+            return res
+
         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: newchange
Gerrit-Change-Id: I75edf26e21fa4da01b4a66670b475ac271d086fb
Gerrit-PatchSet: 3
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Scott Emidy <jemidy at digium.com>



More information about the asterisk-code-review mailing list