[Asterisk-code-review] rest api/channels/playback/lists: Add a test for stopping a ... (testsuite[master])

Matt Jordan asteriskteam at digium.com
Tue Sep 6 15:33:35 CDT 2016


Matt Jordan has uploaded a new change for review.

  https://gerrit.asterisk.org/3834

Change subject: rest_api/channels/playback/lists: Add a test for stopping a list playback
......................................................................

rest_api/channels/playback/lists: Add a test for stopping a list playback

This test verifies that if a 'stop' command is issued via a DELETE
during the middle of a list Playback, that:
 (a) we actually do stop the playback of the current URI
 (b) no subsequent URIs are played back
 (c) we get the right URI in the PlaybackFinished event

ASTERISK-26341

Change-Id: I8bc38b0ddc8fbc0012acfd5bb1381ff6a02a3bf6
---
A tests/rest_api/channels/playback/lists/stop/test-config.yaml
M tests/rest_api/channels/playback/lists/tests.yaml
2 files changed, 172 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/34/3834/1

diff --git a/tests/rest_api/channels/playback/lists/stop/test-config.yaml b/tests/rest_api/channels/playback/lists/stop/test-config.yaml
new file mode 100644
index 0000000..d8e5d64
--- /dev/null
+++ b/tests/rest_api/channels/playback/lists/stop/test-config.yaml
@@ -0,0 +1,171 @@
+testinfo:
+    summary: 'Test playback stop of a playlist'
+    description: |
+        * Originate a channel
+        * Playback a list of audio files
+        * Before the list completes, stop the list
+        * Verify that we don't receive any further events
+
+properties:
+    minversion: '14.0.0'
+    dependencies:
+        - python : autobahn.websocket
+        - python : requests
+        - python : twisted
+        - python : starpy
+        - asterisk : res_ari_channels
+        - asterisk : res_ari_playbacks
+        - asterisk : app_echo
+    tags:
+        - ARI
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: ari.AriOriginateTestObject
+    modules:
+        -
+            config-section: ari-config
+            typename: ari.WebSocketEventModule
+        -
+            config-section: ari-test-stopper
+            typename: pluggable_modules.EventActionModule
+        -
+            config-section: asterisk-config
+            typename: pluggable_modules.AsteriskConfigModule
+
+asterisk-config:
+    -
+        src: 'tests/rest_api/channels/playback/lists/configs/extensions.conf'
+        dst: 'extensions.conf'
+
+test-object-config:
+    stop-on-end: False
+
+ari-test-stopper:
+    -
+        ari-events:
+            match:
+                type: ChannelDestroyed
+                application: testsuite
+                channel:
+                    id: 'testsuite-default-id$'
+        stop_test:
+
+ari-config:
+    apps: testsuite
+    events:
+        -
+            conditions:
+                match:
+                    type: 'ChannelStateChange'
+            count: '>1'
+        -
+            conditions:
+                match:
+                    type: StasisStart
+                    application: testsuite
+                    channel:
+                        id: 'testsuite-default-id$'
+            count: 1
+            requests:
+                method: 'post'
+                uri: 'channels/testsuite-default-id/play/MyPlaybackId'
+                params:
+                    media: 'sound:silence/1,sound:silence/2,sound:silence/3'
+        -
+            conditions:
+                match:
+                    type: PlaybackStarted
+                    application: testsuite
+                    playback:
+                        id: 'MyPlaybackId'
+                        media_uri: 'sound:silence/1'
+                        next_media_uri: 'sound:silence/2'
+                        target_uri: 'channel:testsuite-default-id$'
+                        state: 'playing'
+            count: 1
+        -
+            conditions:
+                match:
+                    type: PlaybackContinuing
+                    application: testsuite
+                    playback:
+                        id: 'MyPlaybackId'
+                        media_uri: 'sound:silence/1'
+                        next_media_uri: 'sound:silence/2'
+                        target_uri: 'channel:testsuite-default-id$'
+                        state: 'continuing'
+            count: 1
+        -
+            conditions:
+                match:
+                    type: PlaybackStarted
+                    application: testsuite
+                    playback:
+                        id: 'MyPlaybackId'
+                        media_uri: 'sound:silence/2'
+                        next_media_uri: 'sound:silence/3'
+                        target_uri: 'channel:testsuite-default-id$'
+                        state: 'playing'
+            count: 1
+            requests:
+                -
+                    instance: 1
+                    method: 'delete'
+                    uri: 'playbacks/MyPlaybackId'
+        -
+            conditions:
+                match:
+                    type: PlaybackContinuing
+                    application: testsuite
+                    playback:
+                        id: 'MyPlaybackId'
+                        media_uri: 'sound:silence/2'
+                        next_media_uri: 'sound:silence/3'
+                        target_uri: 'channel:testsuite-default-id$'
+                        state: 'continuing'
+            count: 0
+        -
+            conditions:
+                match:
+                    type: PlaybackStarted
+                    application: testsuite
+                    playback:
+                        id: 'MyPlaybackId'
+                        media_uri: 'sound:silence/3'
+                        target_uri: 'channel:testsuite-default-id$'
+                        state: 'playing'
+            count: 0
+        -
+            conditions:
+                match:
+                    type: PlaybackFinished
+                    application: testsuite
+                    playback:
+                        id: 'MyPlaybackId'
+                        media_uri: 'sound:silence/2'
+                        target_uri: 'channel:testsuite-default-id$'
+                        state: 'done'
+            count: 1
+            requests:
+                # playback is already deleted
+                method: 'delete'
+                uri: 'channels/testsuite-default-id'
+        -
+            conditions:
+                match:
+                    type: ChannelHangupRequest
+                    application: testsuite
+                    channel:
+                        id: 'testsuite-default-id$'
+            count: 1
+
+        -
+            conditions:
+                match:
+                    type: StasisEnd
+                    application: testsuite
+                    channel:
+                        id: 'testsuite-default-id$'
+            count: 1
diff --git a/tests/rest_api/channels/playback/lists/tests.yaml b/tests/rest_api/channels/playback/lists/tests.yaml
index 858b701..c5a6173 100644
--- a/tests/rest_api/channels/playback/lists/tests.yaml
+++ b/tests/rest_api/channels/playback/lists/tests.yaml
@@ -2,3 +2,4 @@
     - test: 'basic'
     - test: 'forward'
     - test: 'reverse'
+    - test: 'stop'

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8bc38b0ddc8fbc0012acfd5bb1381ff6a02a3bf6
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list