[asterisk-commits] dlee: testsuite/asterisk/trunk r3888 - in /asterisk/trunk: ./ lib/python/aste...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 5 16:13:48 CDT 2013


Author: dlee
Date: Fri Jul  5 16:13:46 2013
New Revision: 3888

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3888
Log:
More ARI test fixes

Added:
    asterisk/trunk/tests/rest_api/authentication/configs/ast1/ari.conf
      - copied unchanged from r3885, asterisk/trunk/tests/rest_api/authentication/configs/ast1/stasis_http.conf
    asterisk/trunk/tests/rest_api/continue/configs/ast1/ari.conf
      - copied unchanged from r3885, asterisk/trunk/tests/rest_api/continue/configs/ast1/stasis_http.conf
Removed:
    asterisk/trunk/tests/rest_api/authentication/configs/ast1/stasis_http.conf
    asterisk/trunk/tests/rest_api/continue/configs/ast1/stasis_http.conf
Modified:
    asterisk/trunk/lib/python/asterisk/TestRunner.py
    asterisk/trunk/lib/python/asterisk/ari.py
    asterisk/trunk/logger.conf
    asterisk/trunk/tests/rest_api/continue/rest_continue.py
    asterisk/trunk/tests/rest_api/continue/test-config.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=3888&r1=3887&r2=3888
==============================================================================
--- asterisk/trunk/lib/python/asterisk/TestRunner.py (original)
+++ asterisk/trunk/lib/python/asterisk/TestRunner.py Fri Jul  5 16:13:46 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):

Modified: asterisk/trunk/lib/python/asterisk/ari.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/ari.py?view=diff&rev=3888&r1=3887&r2=3888
==============================================================================
--- asterisk/trunk/lib/python/asterisk/ari.py (original)
+++ asterisk/trunk/lib/python/asterisk/ari.py Fri Jul  5 16:13:46 2013
@@ -34,7 +34,7 @@
         :param module_config: Configuration dict parse from test-config.yaml.
         :param test_object: Test control object.
         '''
-        logger.info("WebSocketEventModule ctor")
+        logger.debug("WebSocketEventModule(%r)", test_object)
         self.host = '127.0.0.1'
         self.port = DEFAULT_PORT
         self.test_object = test_object
@@ -60,6 +60,7 @@
 
         :param event: Dictionary parsed from incoming JSON event.
         '''
+        logger.error('%r' % event)
         for matcher in self.event_matchers:
             matcher.on_event(event)
 
@@ -77,10 +78,11 @@
         :param port: Port of Asterisk web server.
         :param timeout_secs: Maximum time to try to connect to Asterisk.
         '''
-        url = "ws://%s:%d/ws?%s" % \
+        url = "ws://%s:%d/ari/events?%s" % \
               (host, port,
                urllib.urlencode({'app': apps, 'api_key': '%s:%s' % userpass}))
-        WebSocketClientFactory.__init__(self, url, protocols=["stasis"])
+        logger.info("WebSocketClientFactory(url=%s)" % url)
+        WebSocketClientFactory.__init__(self, url)
         self.on_event = on_event
         self.timeout_secs = timeout_secs
         self.protocol = self.__build_protocol
@@ -146,6 +148,7 @@
 
         :param msg: Received text message.
         '''
+        logger.info("rxed: %s" % msg)
         self.on_event(json.loads(msg))
 
 
@@ -159,7 +162,7 @@
         :param host: Hostname of Asterisk.
         :param port: Port of the Asterisk webserver.
         '''
-        self.base_url = "http://%s:%d/stasis" % (host, port)
+        self.base_url = "http://%s:%d/ari" % (host, port)
         self.userpass = userpass
 
     def build_url(self, *args):

Modified: asterisk/trunk/logger.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/logger.conf?view=diff&rev=3888&r1=3887&r2=3888
==============================================================================
--- asterisk/trunk/logger.conf (original)
+++ asterisk/trunk/logger.conf Fri Jul  5 16:13:46 2013
@@ -22,6 +22,12 @@
 propagate=0
 handlers=stdout,normalFile,verboseFile
 qualname=AMI
+
+[logger_ari]
+level=INFO
+propagate=0
+handlers=stdout,normalFile,verboseFile
+qualname=ari
 
 [logger_asterisk]
 level=NOTSET

Modified: asterisk/trunk/tests/rest_api/continue/rest_continue.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/continue/rest_continue.py?view=diff&rev=3888&r1=3887&r2=3888
==============================================================================
--- asterisk/trunk/tests/rest_api/continue/rest_continue.py (original)
+++ asterisk/trunk/tests/rest_api/continue/rest_continue.py Fri Jul  5 16:13:46 2013
@@ -16,7 +16,7 @@
 def on_start(ari, event):
     logger.debug("on_start(%r)" % event)
     global id
-    id = event['stasis_start']['channel']['uniqueid']
+    id = event['channel']['uniqueid']
     ari.post('channels', id, 'continue')
     return True
 
@@ -24,11 +24,11 @@
 def on_end(ari, event):
     global id
     logger.debug("on_end(%r)" % event)
-    return id == event['stasis_end']['channel']['uniqueid']
+    return id == event['channel']['uniqueid']
 
 
 def on_second_start(ari, event):
     global id
     logger.debug("on_second_start(%r)" % event)
     ari.delete('channels', id)
-    return id == event['stasis_start']['channel']['uniqueid']
+    return id == event['channel']['uniqueid']

Modified: asterisk/trunk/tests/rest_api/continue/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/continue/test-config.yaml?view=diff&rev=3888&r1=3887&r2=3888
==============================================================================
--- asterisk/trunk/tests/rest_api/continue/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/continue/test-config.yaml Fri Jul  5 16:13:46 2013
@@ -24,26 +24,26 @@
     events:
         -   conditions:
                 match:
+                    type: StasisStart
                     application: continue-test
-                    stasis_start:
-                        args: []
+                    args: []
             count: 1
             callback:
                 module: rest_continue
                 method: on_start
         -   conditions:
                 match:
+                    type: StasisEnd
                     application: continue-test
-                    stasis_end:
             count: 2
             callback:
                 module: rest_continue
                 method: on_end
         -   conditions:
                 match:
+                    type: StasisStart
                     application: continue-test
-                    stasis_start:
-                        args: [fin]
+                    args: [fin]
             count: 1
             callback:
                 module: rest_continue




More information about the asterisk-commits mailing list