[asterisk-commits] dlee: branch dlee/ASTERISK-22451-ari-subscribe-tests r4197 - in /asterisk/tea...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Sep 16 15:59:56 CDT 2013
Author: dlee
Date: Mon Sep 16 15:59:54 2013
New Revision: 4197
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4197
Log:
Subscribe endpoint test
Modified:
asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/subscribe_bridge.py
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-endpoint/subscribe_endpoint.py
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/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=diff&rev=4197&r1=4196&r2=4197
==============================================================================
--- asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/subscribe_bridge.py (original)
+++ asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-bridge/subscribe_bridge.py Mon Sep 16 15:59:54 2013
@@ -26,13 +26,28 @@
eventSource='bridge:%s' % TEST.bridge_id)
ari.post('bridges', TEST.bridge_id, 'addChannel',
channel=TEST.channel_id)
+ return True
-def on_enter(ari, event):
+def on_enter_testsuite(ari, event):
assert TEST.bridge_id == event['bridge']['id']
assert TEST.channel_id == event['channel']['id']
- ari.delete('bridges', TEST.bridge_id)
+ # Unsubscribe testsuite from the bridge
+ ari.delete('applications', 'testsuite', 'subscription',
+ eventSource='bridge:%s' % TEST.bridge_id)
+ return True
-def on_bridge_destroy(ari, event):
+def on_enter_watcher(ari, event):
assert TEST.bridge_id == event['bridge']['id']
+ assert TEST.channel_id == event['channel']['id']
+ ari.post('bridges', TEST.bridge_id, 'removeChannel',
+ channel=TEST.channel_id)
+ return True
+
+
+def on_channel_left_bridge(ari, event):
+ assert TEST.bridge_id == event['bridge']['id']
+ assert TEST.channel_id == event['channel']['id']
+ ari.delete('channels', TEST.channel_id);
+ return True
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=4197&r1=4196&r2=4197
==============================================================================
--- 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 Mon Sep 16 15:59:54 2013
@@ -29,22 +29,40 @@
- conditions:
match:
type: ChannelEnteredBridge
+ application: testsuite
+ bridge:
+ channel:
+ count: 1
+ callback:
+ module: subscribe_bridge
+ method: on_enter_testsuite
+ - conditions:
+ match:
+ type: ChannelEnteredBridge
application: bridge-watching-app
bridge:
channel:
- count: 1
- callback:
- module: subscribe_bridge
- method: on_enter
+ count: 1
+ callback:
+ module: subscribe_bridge
+ method: on_enter_watcher
- conditions:
match:
- type: BridgeDestroyed
+ type: ChannelLeftBridge
+ application: testsuite
+ bridge:
+ channel:
+ count: 0 # should not happen
+ - conditions:
+ match:
+ type: ChannelLeftBridge
application: bridge-watching-app
bridge:
- count: 1
- callback:
- module: subscribe_bridge
- method: on_bridge_destroy
+ channel:
+ count: 1
+ callback:
+ module: subscribe_bridge
+ method: on_channel_left_bridge
properties:
minversion: '12.0.0'
Modified: asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-endpoint/subscribe_endpoint.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-endpoint/subscribe_endpoint.py?view=diff&rev=4197&r1=4196&r2=4197
==============================================================================
--- asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-endpoint/subscribe_endpoint.py (original)
+++ asterisk/team/dlee/ASTERISK-22451-ari-subscribe-tests/tests/rest_api/applications/subscribe-endpoint/subscribe_endpoint.py Mon Sep 16 15:59:54 2013
@@ -20,7 +20,8 @@
def on_start(ari, event):
- assert event['channel']['name'].startswith(self.endpoint_id)
+ LOGGER.debug('on_start(%r)' % event)
+ assert event['channel']['name'].startswith(TEST.endpoint_id)
TEST.channel_id = event['channel']['id']
ari.post('applications', 'testsuite', 'subscription',
eventSource='endpoint:%s' % TEST.endpoint_id)
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=4197&r1=4196&r2=4197
==============================================================================
--- 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 Mon Sep 16 15:59:54 2013
@@ -2,5 +2,5 @@
tests:
- test: 'errors'
- test: 'subscribe-channel'
-# - test: 'subscribe-endpoint'
+ - test: 'subscribe-endpoint'
- test: 'subscribe-bridge'
More information about the asterisk-commits
mailing list