[svn-commits] dlee: branch dlee/ASTERISK-22451-ari-subscribe-tests r4164 - /asterisk/team/d...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Sep 11 15:21:36 CDT 2013


Author: dlee
Date: Wed Sep 11 15:21:34 2013
New Revision: 4164

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4164
Log:
Error case testing works

Modified:
    asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/errors/errors.py

Modified: asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/errors/errors.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/errors/errors.py?view=diff&rev=4164&r1=4163&r2=4164
==============================================================================
--- asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/errors/errors.py (original)
+++ asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/errors/errors.py Wed Sep 11 15:21:34 2013
@@ -6,6 +6,7 @@
 the GNU General Public License Version 2.
 '''
 
+import requests
 import logging
 
 LOGGER = logging.getLogger(__name__)
@@ -15,13 +16,15 @@
     '''Validate a response against its expected code'''
     expected_code = requests.codes[expected]
     if expected_code != resp.status_code:
-        LOGGER.error("Expected %d (%s), got %s (%r)", expected_code,
-                     expected, resp.status_code, resp.json())
+        LOGGER.error("%s: Expected %d (%s), got %s (%r)", resp.url,
+                     expected_code, expected, resp.status_code, resp.json())
         raise ValueError('Test failed')
 
 
 def on_start(ari, event):
     LOGGER.debug('on_start(%r)' % event)
+
+    channel_id = event["channel"]["id"]
 
     app_list = ari.get('applications').json()
     assert 1 == len(app_list)
@@ -33,27 +36,27 @@
     resp = ari.get('applications', 'notanapp')
     validate('not_found', resp)
 
-    ari.post('applications', 'testsuite', 'subscription')
+    resp = ari.post('applications', 'testsuite', 'subscription')
     validate('bad_request', resp)
 
-    ari.delete('applications', 'testsuite', 'subscription')
+    resp = ari.delete('applications', 'testsuite', 'subscription')
     validate('bad_request', resp)
 
-    ari.post('applications', 'testsuite', 'subscription',
+    resp = ari.post('applications', 'testsuite', 'subscription',
              eventSource='notascheme:foo')
     validate('bad_request', resp)
 
-    ari.delete('applications', 'testsuite', 'subscription',
+    resp = ari.delete('applications', 'testsuite', 'subscription',
              eventSource='notascheme:foo')
     validate('bad_request', resp)
 
-    ari.post('applications', 'testsuite', 'subscription',
+    resp = ari.post('applications', 'testsuite', 'subscription',
              eventSource='channel:notachannel')
     validate('unprocessable_entity', resp)
 
-    ari.delete('applications', 'testsuite', 'subscription',
+    resp = ari.delete('applications', 'testsuite', 'subscription',
              eventSource='channel:notachannel')
     validate('unprocessable_entity', resp)
 
-    ari.post('channels', test_data.channel_id, 'continue')
+    ari.post('channels', channel_id, 'continue')
     return True




More information about the svn-commits mailing list