[asterisk-commits] dlee: branch dlee/ASTERISK-22451-ari-subscribe-tests r4155 - in /asterisk/tea...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 10 23:17:58 CDT 2013


Author: dlee
Date: Tue Sep 10 23:17:56 2013
New Revision: 4155

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4155
Log:
Potential test

Modified:
    asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/lib/python/asterisk/ari.py
    asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-channel/subscribe_channel.py

Modified: asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/lib/python/asterisk/ari.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/lib/python/asterisk/ari.py?view=diff&rev=4155&r1=4154&r2=4155
==============================================================================
--- asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/lib/python/asterisk/ari.py (original)
+++ asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/lib/python/asterisk/ari.py Tue Sep 10 23:17:56 2013
@@ -196,8 +196,12 @@
         :param event: Dictionary parsed from incoming JSON event.
         '''
         LOGGER.debug('Received event: %r' % event.get('type'))
+        matched = False
         for matcher in self.event_matchers:
-            matcher.on_event(event)
+            if matcher.on_event(event):
+                matched = True
+        if not matched:
+            LOGGER.info('Event had no matcher: %r' % event)
 
 
 class AriClientFactory(WebSocketClientFactory):
@@ -334,7 +338,7 @@
         :returns: requests.models.Response
         :throws: requests.exceptions.HTTPError
         '''
-        url = self.build_url(*args, **kwargs)
+        url = self.build_url(*args)
         LOGGER.info("POST %s %r" % (url, kwargs))
         return raise_on_err(requests.post(url, params=kwargs,
                                           auth=self.userpass))
@@ -347,7 +351,7 @@
         :returns: requests.models.Response
         :throws: requests.exceptions.HTTPError
         '''
-        url = self.build_url(*args, **kwargs)
+        url = self.build_url(*args)
         LOGGER.info("DELETE %s %r" % (url, kwargs))
         return raise_on_err(requests.delete(url, params=kwargs,
                                             auth=self.userpass))
@@ -394,7 +398,9 @@
             # Split call and accumulation to always call the callback
             try:
                 res = self.callback(self.ari, message)
-                if not res:
+                if res:
+                    return True
+                else:
                     LOGGER.error("Callback failed: %r" %
                                  self.instance_config)
                     self.passed = False
@@ -402,6 +408,7 @@
                 LOGGER.error("Exception in callback: %s" %
                              traceback.format_exc())
                 self.passed = False
+        return False
 
     def on_stop(self, *args):
         '''Callback for the end of the test.

Modified: asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-channel/subscribe_channel.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-channel/subscribe_channel.py?view=diff&rev=4155&r1=4154&r2=4155
==============================================================================
--- asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-channel/subscribe_channel.py (original)
+++ asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-channel/subscribe_channel.py Tue Sep 10 23:17:56 2013
@@ -15,12 +15,14 @@
         self.channel_id = None
         self.has_ended = False
 
+
 test_data = TestData()
+
 
 def on_start(ari, event):
     LOGGER.debug("on_start(%r)" % event)
     test_data.channel_id = event["channel"]["id"]
-    ari.post("applications", "testsuite", "subscribe",
+    ari.post("applications", "testsuite", "subscription",
              eventSource="channel:%s" % test_data.channel_id)
     ari.post("chanels", test_data.channel_id, "continue")
     return True




More information about the asterisk-commits mailing list