[svn-commits] dlee: testsuite/asterisk/trunk r3866 - in /asterisk/trunk: lib/python/asteris...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jun 21 16:45:18 CDT 2013


Author: dlee
Date: Fri Jun 21 16:45:12 2013
New Revision: 3866

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3866
Log:
Add module for testing RESTful API's

This patch adds a pluggable module to the Asterisk testing framework
to aid in testing the new Asterisk 12 RESTful API's.

It is similar in scope to the AMI plugable module. In the test's
test-config.yaml file, event specifications can be specified, along
with requirements for passing the test. The only requirements
implemented by this patch are count (which support >, < and exact
count) and callback (which is also where custom logic may be kicked
off on events).

The WebSocket client is implemented using autobahn's WebSocket
support[1], since that plays very nicely with our Twisted infected
framework. RESTful API invocations are made using Requests[2], since
it's an extremely convenient abstraction for HTTP.

A test for the /channels/{channelId}/continue resource was added for
the initial implementation.

 [1]: http://autobahn.ws/
 [2]: http://docs.python-requests.org/en/latest/

(closes issue ASTERISK-21818)
Review: https://reviewboard.asterisk.org/r/2618/

Added:
    asterisk/trunk/lib/python/asterisk/ari.py
      - copied unchanged from r3846, asterisk/team/dlee/ari-tests/lib/python/asterisk/ari.py
    asterisk/trunk/sample-yaml/ari-config.yaml.sample
      - copied, changed from r3846, asterisk/team/dlee/ari-tests/sample-yaml/ari-config.yaml.sample
    asterisk/trunk/tests/rest_api/
      - copied from r3846, asterisk/team/dlee/ari-tests/tests/rest_api/
Modified:
    asterisk/trunk/lib/python/asterisk/TestRunner.py
    asterisk/trunk/tests/tests.yaml

Modified: asterisk/trunk/lib/python/asterisk/TestRunner.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/TestRunner.py?view=diff&rev=3866&r1=3865&r2=3866
==============================================================================
--- asterisk/trunk/lib/python/asterisk/TestRunner.py (original)
+++ asterisk/trunk/lib/python/asterisk/TestRunner.py Fri Jun 21 16:45:12 2013
@@ -50,7 +50,7 @@
         for path in search_paths:
             if os.path.exists('%s/%s.py' % (path, fullname)):
                 return TestModuleLoader(path)
-        LOGGER.warn("Unable to find module '%s'" % fullname)
+        LOGGER.debug("Unable to find module '%s'" % fullname)
         return None
 
 class TestModuleLoader(object):

Copied: asterisk/trunk/sample-yaml/ari-config.yaml.sample (from r3846, asterisk/team/dlee/ari-tests/sample-yaml/ari-config.yaml.sample)
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/sample-yaml/ari-config.yaml.sample?view=diff&rev=3866&p1=asterisk/team/dlee/ari-tests/sample-yaml/ari-config.yaml.sample&r1=3846&p2=asterisk/trunk/sample-yaml/ari-config.yaml.sample&r2=3866
==============================================================================
--- asterisk/team/dlee/ari-tests/sample-yaml/ari-config.yaml.sample (original)
+++ asterisk/trunk/sample-yaml/ari-config.yaml.sample Fri Jun 21 16:45:12 2013
@@ -24,13 +24,17 @@
                 match:
                     application: foo-test
                     stasis_start:
+                        # in-line flow style may be used for arrays
                         args: ['bar.*']
                 # Specified a pattern that must NOT match the received JSON
                 # object. The pattern is evaluated identically to a match
                 # clause
                 nomatch:
                     stasis_start:
-                        args: ['barman.*']
+                        # block sequences can also be used for arrays
+                        args:
+                            - 'barman.*'
+
 
             # The above example would match the following:
             #  { 'application': 'foo-test', 'args': [ 'bar' ] }

Modified: asterisk/trunk/tests/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/tests.yaml?view=diff&rev=3866&r1=3865&r2=3866
==============================================================================
--- asterisk/trunk/tests/tests.yaml (original)
+++ asterisk/trunk/tests/tests.yaml Fri Jun 21 16:45:12 2013
@@ -27,3 +27,4 @@
     - dir: 'redirecting'
     - test: 'cause_answered_elsewhere'
     - dir: 'bridge'
+    - dir: 'rest_api'




More information about the svn-commits mailing list