[asterisk-commits] mjordan: testsuite/asterisk/trunk r5755 - /asterisk/trunk/tests/rest_api/dang...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 17 19:35:34 CDT 2014


Author: mjordan
Date: Fri Oct 17 19:35:28 2014
New Revision: 5755

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5755
Log:
rest_api/danger/safe: Fix test for Asterisk 12

In Asterisk 13+, violating the 'live dangerously' settings will return a
500 exception. In Asterisk 12, the command will return 200, but technically
fail internally. This patch updates the testsuite with the expected response
for 12 and 13.

Modified:
    asterisk/trunk/tests/rest_api/danger/safe/safe.py

Modified: asterisk/trunk/tests/rest_api/danger/safe/safe.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/danger/safe/safe.py?view=diff&rev=5755&r1=5754&r2=5755
==============================================================================
--- asterisk/trunk/tests/rest_api/danger/safe/safe.py (original)
+++ asterisk/trunk/tests/rest_api/danger/safe/safe.py Fri Oct 17 19:35:28 2014
@@ -7,8 +7,13 @@
 """
 
 import logging
+import sys
 
 LOGGER = logging.getLogger(__name__)
+
+sys.path.append('lib/python/asterisk')
+
+from version import AsteriskVersion
 
 def eq(expected, actual):
     if expected != actual:
@@ -20,10 +25,15 @@
     actual = resp.json()["value"]
     eq('works', actual)
 
-    ari.set_allow_errors(True)
+    if AsteriskVersion() >= AsteriskVersion('13'):
+        ari.set_allow_errors(True)
     resp = ari.get('channels', channel_id, 'variable', variable='SHELL(echo -n fail)')
-    ari.set_allow_errors(False)
-    eq(500, resp.status_code)
+    if AsteriskVersion() >= AsteriskVersion('13'):
+        ari.set_allow_errors(False)
+        eq(500, resp.status_code)
+    else:
+        eq(200, resp.status_code)
+        eq(resp.json().get('value'), '')
 
 
 def on_start(ari, event, test_object):




More information about the asterisk-commits mailing list