[Asterisk-code-review] rest api/applications/subscribe-all-bridge: Add test for bri... (testsuite[master])

Joshua Colp asteriskteam at digium.com
Mon Nov 7 09:02:35 CST 2016


Joshua Colp has uploaded a new change for review. ( https://gerrit.asterisk.org/4337 )

Change subject: rest_api/applications/subscribe-all-bridge: Add test for bridges.
......................................................................

rest_api/applications/subscribe-all-bridge: Add test for bridges.

This adds a test which is specific for bridge subscribe all
subscriptions. It confirms that after a bridge is created,
a channel added and removed, and the bridge destroyed that events
continue to be received based on the subscribe all subscription.

ASTERISK-26468

Change-Id: Ib84581a5effca3c34cfcee705e7accfc28370946
---
A tests/rest_api/applications/subscribe-all-bridge/configs/ast1/extensions.conf
A tests/rest_api/applications/subscribe-all-bridge/test-config.yaml
M tests/rest_api/applications/tests.yaml
3 files changed, 171 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/37/4337/1

diff --git a/tests/rest_api/applications/subscribe-all-bridge/configs/ast1/extensions.conf b/tests/rest_api/applications/subscribe-all-bridge/configs/ast1/extensions.conf
new file mode 100644
index 0000000..9426d78
--- /dev/null
+++ b/tests/rest_api/applications/subscribe-all-bridge/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+
+exten => s,1,NoOp()
+	same => n,Answer()
+        same => n,Echo()
+
diff --git a/tests/rest_api/applications/subscribe-all-bridge/test-config.yaml b/tests/rest_api/applications/subscribe-all-bridge/test-config.yaml
new file mode 100644
index 0000000..b1951df
--- /dev/null
+++ b/tests/rest_api/applications/subscribe-all-bridge/test-config.yaml
@@ -0,0 +1,164 @@
+testinfo:
+    summary: 'Test subscription to all bridges.'
+    description: |
+        * Subscribe the application to all bridge events
+        * Create channel 1 using channels/originate with endpoint = Local/s at default
+        * Wait for channel to enter Stasis application
+        * Create bridge 1
+        * Place channel into bridge 1
+        * Remove channel from bridge 1
+        * Delete the bridge
+        * Create bridge 2
+        * Wait for BridgeCreated event
+        * Delete bridge 2
+        * Delete the channel
+        * Stop.
+
+test-modules:
+    test-object:
+        config-section: 'test-object-config'
+        typename: 'ari.AriBaseTestObject'
+    modules:
+    -   config-section: 'pluggable-config'
+        typename: 'pluggable_modules.EventActionModule'
+
+test-object-config:
+    apps: 'testsuite'
+    reactor-timeout: 30
+    stop-on-end: False
+
+pluggable-config:
+    -
+        ari-start:
+        ari-requests:
+            -
+                method: 'post'
+                uri: 'applications/testsuite/subscription?eventSource=bridge:'
+                expect: 200
+            -   method: 'post'
+                uri: 'channels'
+                params:
+                    endpoint: 'Local/s at default'
+                    app: 'testsuite'
+                    channelId: 'channel1'
+                expect: 200
+
+    -   ari-events:
+            match:
+                type: 'StasisStart'
+                application: 'testsuite'
+                channel:
+                    id: 'channel1'
+            count: 1
+        ari-requests:
+            -   method: 'post'
+                uri: 'bridges'
+                params:
+                    bridgeId: 'bridge1'
+                expect: 200
+    -   ari-events:
+            -
+                match:
+                    type: 'BridgeCreated'
+                    bridge:
+                        technology: 'simple_bridge'
+                        bridge_type: 'mixing'
+                        bridge_class: 'stasis'
+                        id: 'bridge1'
+                count: 1
+        ari-requests:
+            -   method: 'post'
+                uri: 'bridges/bridge1/addChannel'
+                params:
+                   channel: 'channel1'
+                expect: 204
+    -   ari-events:
+            -
+                match:
+                    type: 'ChannelEnteredBridge'
+                    channel:
+                        id: 'channel1'
+                    bridge:
+                        technology: 'simple_bridge'
+                        bridge_type: 'mixing'
+                        bridge_class: 'stasis'
+                        id: 'bridge1'
+                count: 1
+        ari-requests:
+            -   method: 'post'
+                uri: 'bridges/bridge1/removeChannel'
+                params:
+                   channel: 'channel1'
+                expect: 204
+    -   ari-events:
+            -
+                match:
+                    type: 'ChannelLeftBridge'
+                    channel:
+                        id: 'channel1'
+                    bridge:
+                        technology: 'simple_bridge'
+                        bridge_type: 'mixing'
+                        bridge_class: 'stasis'
+                        id: 'bridge1'
+                count: 1
+        ari-requests:
+            -   method: 'delete'
+                uri: 'bridges/bridge1'
+                expect: 204
+    -   ari-events:
+            -
+                match:
+                    type: 'BridgeDestroyed'
+                    bridge:
+                        technology: 'simple_bridge'
+                        bridge_type: 'mixing'
+                        bridge_class: 'stasis'
+                        id: 'bridge1'
+                count: 1
+        ari-requests:
+            -   method: 'post'
+                uri: 'bridges'
+                params:
+                    bridgeId: 'bridge2'
+                expect: 200
+    -   ari-events:
+            -
+                match:
+                    type: 'BridgeCreated'
+                    bridge:
+                        technology: 'simple_bridge'
+                        bridge_type: 'mixing'
+                        bridge_class: 'stasis'
+                        id: 'bridge2'
+                count: 1
+        ari-requests:
+            -   method: 'delete'
+                uri: 'bridges/bridge2'
+                expect: 204
+    -   ari-events:
+            -
+                match:
+                    type: 'BridgeDestroyed'
+                    bridge:
+                        technology: 'simple_bridge'
+                        bridge_type: 'mixing'
+                        bridge_class: 'stasis'
+                        id: 'bridge2'
+                count: 1
+        ari-requests:
+            -   method: 'delete'
+                uri: 'channels/channel1'
+                expect: 204
+        stop_test:
+
+properties:
+    minversion: '13.13.0'
+    dependencies:
+    -   python: 'autobahn.websocket'
+    -   python: 'requests'
+    -   python: 'twisted'
+    -   python: 'starpy'
+    -   asterisk: 'res_ari_channels'
+    tags:
+    - ARI
diff --git a/tests/rest_api/applications/tests.yaml b/tests/rest_api/applications/tests.yaml
index 2d98c2d..0ed0bf6 100644
--- a/tests/rest_api/applications/tests.yaml
+++ b/tests/rest_api/applications/tests.yaml
@@ -3,6 +3,7 @@
     - test: 'errors'
     - dir: 'subscribe-endpoint'
     - test: 'subscribe-all'
+    - test: 'subscribe-all-bridge'
     - test: 'subscribe-bridge'
     - test: 'subscribe-device-state'
     - test: 'double-subscribe-device-state'

-- 
To view, visit https://gerrit.asterisk.org/4337
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib84581a5effca3c34cfcee705e7accfc28370946
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list