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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 12 14:56:05 CDT 2013


Author: dlee
Date: Thu Sep 12 14:56:03 2013
New Revision: 4177

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4177
Log:
Bridge subscription test

Added:
    asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/subscribe_bridge.py   (with props)
Modified:
    asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/configs/ast1/extensions.conf
    asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/test-config.yaml
    asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-channel/subscribe_channel.py
    asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-channel/test-config.yaml
    asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/tests.yaml

Modified: asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/configs/ast1/extensions.conf?view=diff&rev=4177&r1=4176&r2=4177
==============================================================================
--- asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/configs/ast1/extensions.conf (original)
+++ asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/configs/ast1/extensions.conf Thu Sep 12 14:56:03 2013
@@ -3,5 +3,4 @@
 exten => s,1,NoOp()
 	same => n,Answer()
 	same => n,Stasis(testsuite)
-	same => n,Stasis(testsuite,fin)
 	same => n,Hangup()

Added: asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/subscribe_bridge.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/subscribe_bridge.py?view=auto&rev=4177
==============================================================================
--- asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/subscribe_bridge.py (added)
+++ asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/subscribe_bridge.py Thu Sep 12 14:56:03 2013
@@ -1,0 +1,38 @@
+'''
+Copyright (C) 2013, Digium, Inc.
+David M. Lee, II <dlee at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import logging
+
+LOGGER = logging.getLogger(__name__)
+
+class SubscribeBridge(object):
+    def __init__(self):
+        self.channels = None
+        self.bridge_id = None
+
+
+TEST = SubscribeBridge()
+
+
+def on_start(ari, event):
+    TEST.channel_id = event['channel']['id']
+    TEST.bridge_id = ari.post('bridges').json()['id']
+    ari.post('applications', 'bridge-watching-app', 'subscription',
+             eventSource='bridge:%s' % TEST.bridge_id)
+    ari.post('bridges', TEST.bridge_id, 'addChannel',
+             channel=TEST.channel_id)
+
+
+def on_enter(ari, event):
+    assert TEST.bridge_id == event['bridge']['id']
+    assert TEST.channel_id == event['channel']['id']
+    ari.delete('bridges', TEST.bridge_id)
+
+
+def on_bridge_destroy(ari, event):
+    assert TEST.bridge_id == event['bridge']['id']

Propchange: asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/subscribe_bridge.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/subscribe_bridge.py
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/subscribe_bridge.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/test-config.yaml?view=diff&rev=4177&r1=4176&r2=4177
==============================================================================
--- asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/test-config.yaml (original)
+++ asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/test-config.yaml Thu Sep 12 14:56:03 2013
@@ -13,8 +13,7 @@
         -   config-section: ari-config
             typename: ari.WebSocketEventModule
 
-test-object-config:
-
+apps: testsuite,bridge-watching-app
 
 ari-config:
     events:
@@ -25,8 +24,27 @@
                     args: []
             count: 1
             callback:
-                module: 
+                module: subscribe_bridge
                 method: on_start
+        -   conditions:
+                match:
+                    type: ChannelEnteredBridge
+                    application: bridge-watching-app
+                    bridge:
+                    channel:
+                count: 1
+                callback:
+                    module: subscribe_bridge
+                    method: on_enter
+        -   conditions:
+                match:
+                    type: BridgeDestroyed
+                    application: bridge-watching-app
+                    bridge:
+                count: 1
+                callback:
+                    module: subscribe_bridge
+                    method: on_bridge_destroy
 
 properties:
     minversion: '12.0.0'

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=4177&r1=4176&r2=4177
==============================================================================
--- 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 Thu Sep 12 14:56:03 2013
@@ -16,25 +16,25 @@
         self.has_ended = False
 
 
-test_data = TestData()
+TEST = TestData()
 
 
 def on_start(ari, event):
     LOGGER.debug("on_start(%r)" % event)
-    test_data.channel_id = event["channel"]["id"]
+    TEST.channel_id = event["channel"]["id"]
     ari.post("applications", "testsuite", "subscription",
-             eventSource="channel:%s" % test_data.channel_id)
-    ari.post("channels", test_data.channel_id, "continue")
+             eventSource="channel:%s" % TEST.channel_id)
+    ari.post("channels", TEST.channel_id, "continue")
     return True
 
 
 def on_end(ari, event):
     LOGGER.debug("on_end(%r)" % event)
-    test_data.has_ended = True
+    TEST.has_ended = True
     return True
 
 
 def on_state_change(ari, event):
     LOGGER.debug("on_state_change(%r)" % event)
-    assert test_data.has_ended, "Expected no state changes before StasisEnd"
+    assert TEST.has_ended, "Expected no state changes before StasisEnd"
     return True

Modified: asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-channel/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-channel/test-config.yaml?view=diff&rev=4177&r1=4176&r2=4177
==============================================================================
--- asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-channel/test-config.yaml (original)
+++ asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-channel/test-config.yaml Thu Sep 12 14:56:03 2013
@@ -13,9 +13,6 @@
     modules:
         -   config-section: ari-config
             typename: ari.WebSocketEventModule
-
-test-object-config:
-
 
 ari-config:
     events:

Modified: asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/tests.yaml?view=diff&rev=4177&r1=4176&r2=4177
==============================================================================
--- asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/tests.yaml (original)
+++ asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/tests.yaml Thu Sep 12 14:56:03 2013
@@ -3,4 +3,4 @@
     - test: 'errors'
     - test: 'subscribe-channel'
 #    - test: 'subscribe-endpoint'
-#    - test: 'subscribe-bridge'
+    - test: 'subscribe-bridge'




More information about the asterisk-commits mailing list