[asterisk-commits] tests/rest api/channels/playback: Add a basic test for media... (testsuite[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed May 18 17:41:11 CDT 2016
Anonymous Coward #1000019 has submitted this change and it was merged.
Change subject: tests/rest_api/channels/playback: Add a basic test for media lists
......................................................................
tests/rest_api/channels/playback: Add a basic test for media lists
This patch adds a basic test for playing back a list of media. The test
spawns a channel which has three sound files played back on it. The test
verifies the events for each sound file, as well as the expected events
for the entire play list. The test also verifies that the pause/unpause
operation works on a media file in the list.
ASTERISK-26022
Change-Id: I9a569d78d7fdb1072a52103f35230caedce40857
---
A tests/rest_api/channels/playback/lists/basic/test-config.yaml
A tests/rest_api/channels/playback/lists/configs/extensions.conf
A tests/rest_api/channels/playback/lists/tests.yaml
M tests/rest_api/channels/playback/tests.yaml
4 files changed, 203 insertions(+), 0 deletions(-)
Approvals:
Mark Michelson: Looks good to me, approved
Anonymous Coward #1000019: Verified
Joshua Colp: Looks good to me, but someone else must approve
diff --git a/tests/rest_api/channels/playback/lists/basic/test-config.yaml b/tests/rest_api/channels/playback/lists/basic/test-config.yaml
new file mode 100644
index 0000000..e7e235a
--- /dev/null
+++ b/tests/rest_api/channels/playback/lists/basic/test-config.yaml
@@ -0,0 +1,192 @@
+testinfo:
+ summary: 'Test playback start and manipulation using IDs'
+ description: |
+ * Originate a channel
+ * Playback a list of audio files
+ * Pause it
+ * Unpause it
+ * Restart it
+ * Delete the channel
+ * Validate all the 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
+ -
+ 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: 1
+ -
+ conditions:
+ match:
+ type: PlaybackStarted
+ application: testsuite
+ playback:
+ id: 'MyPlaybackId'
+ media_uri: 'sound:silence/3'
+ target_uri: 'channel:testsuite-default-id$'
+ state: 'playing'
+ count: 2
+ requests:
+ -
+ instance: 1
+ delay: 1
+ method: 'post'
+ uri: 'playbacks/MyPlaybackId/control'
+ params:
+ operation: pause
+ # pause operation does not generate an event
+ -
+ instance: 1
+ delay: 2
+ method: 'post'
+ uri: 'playbacks/MyPlaybackId/control'
+ params:
+ operation: unpause
+ # unpause operation triggers PlaybackStarted instance #2
+ -
+ instance: 2
+ method: 'post'
+ uri: 'playbacks/MyPlaybackId/control'
+ params:
+ operation: restart
+ -
+ conditions:
+ match:
+ type: PlaybackFinished
+ application: testsuite
+ playback:
+ id: 'MyPlaybackId'
+ media_uri: 'sound:silence/3'
+ 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/configs/extensions.conf b/tests/rest_api/channels/playback/lists/configs/extensions.conf
new file mode 100644
index 0000000..59c7f03
--- /dev/null
+++ b/tests/rest_api/channels/playback/lists/configs/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+
+exten => s,1,NoOp()
+ same => n,Answer()
+ same => n,Echo()
+ same => n,Hangup()
diff --git a/tests/rest_api/channels/playback/lists/tests.yaml b/tests/rest_api/channels/playback/lists/tests.yaml
new file mode 100644
index 0000000..9e4b026
--- /dev/null
+++ b/tests/rest_api/channels/playback/lists/tests.yaml
@@ -0,0 +1,4 @@
+tests:
+ - test: 'basic'
+
+
diff --git a/tests/rest_api/channels/playback/tests.yaml b/tests/rest_api/channels/playback/tests.yaml
index a4fee5a..82d4e02 100644
--- a/tests/rest_api/channels/playback/tests.yaml
+++ b/tests/rest_api/channels/playback/tests.yaml
@@ -7,3 +7,4 @@
- test: 'tones_w_tonezone'
- test: 'forward'
- test: 'reverse'
+ - dir: 'lists'
--
To view, visit https://gerrit.asterisk.org/2846
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9a569d78d7fdb1072a52103f35230caedce40857
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
More information about the asterisk-commits
mailing list