[Asterisk-code-review] testsuite: Added test for 'move' REST API call. (...testsuite[13])

Friendly Automation asteriskteam at digium.com
Tue Mar 12 09:57:23 CDT 2019


Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/testsuite/+/10897 )

Change subject: testsuite: Added test for 'move' REST API call.
......................................................................

testsuite: Added test for 'move' REST API call.

Added a new test that covers some simple use cases of the new 'move'
REST API call, which moves a channel from one application to another
without having to leave Stasis and re-enter dialplan. It tests a few
basic scenarios by putting a channel into Stasis and calling 'move' in
various ways, including trying to move to an application that doesn't
exist, moving to an application without specifying arguments, moving to
an application while specifying a single argument, and moving to an
application while specifying multiple arguments.

Change-Id: I83a2da829dc363727de8c7b56680d21692011e40
---
A tests/rest_api/move/configs/ast1/extensions.conf
A tests/rest_api/move/test-config.yaml
M tests/rest_api/tests.yaml
3 files changed, 134 insertions(+), 0 deletions(-)

Approvals:
  Joshua C. Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/tests/rest_api/move/configs/ast1/extensions.conf b/tests/rest_api/move/configs/ast1/extensions.conf
new file mode 100644
index 0000000..1ab047e
--- /dev/null
+++ b/tests/rest_api/move/configs/ast1/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/move/test-config.yaml b/tests/rest_api/move/test-config.yaml
new file mode 100644
index 0000000..c4c23b1
--- /dev/null
+++ b/tests/rest_api/move/test-config.yaml
@@ -0,0 +1,127 @@
+testinfo:
+    summary: Test moving from one Stasis application to another.
+    description: |
+        "Test that moving from one Stasis application to another via the
+        move REST API call works as intended.
+
+        A few different scenarios are covered:
+            - Moving from one app to another
+            - Switching apps and supplying one argument
+            - Switching apps and supplying multiple arguments
+            - Attempting to switch to a non-existent app"
+
+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
+
+test-object-config:
+    apps: testsuite,no-args,one-arg,multiple-args
+    stop-on-end: False
+
+ari-test-stopper:
+    -
+        ari-events:
+            match:
+                type: ChannelDestroyed
+                application: testsuite
+                channel:
+                    id: 'testsuite-default-id'
+        stop_test:
+
+ari-config:
+    events:
+        -
+            conditions:
+                match:
+                    type: StasisStart
+                    application: testsuite
+            count: '1'
+            requests:
+                -
+                    method: 'post'
+                    uri: 'channels/testsuite-default-id/move'
+                    params:
+                        app: 'i-dont-exist'
+                -
+                    method: 'post'
+                    uri: 'channels/testsuite-default-id/move'
+                    params:
+                        app: 'no-args'
+        -
+            conditions:
+                match:
+                    type: StasisEnd
+                    application: testsuite
+            count: '1'
+        -
+            conditions:
+                match:
+                    type: StasisStart
+                    application: no-args
+            count: '1'
+            requests:
+                method: 'post'
+                uri: 'channels/testsuite-default-id/move'
+                params:
+                    app: 'one-arg'
+                    appArgs: 'apples'
+        -
+            conditions:
+                match:
+                    type: StasisEnd
+                    application: no-args
+            count: '1'
+        -
+            conditions:
+                match:
+                    type: StasisStart
+                    application: one-arg
+                    args: ['apples']
+            count: '1'
+            requests:
+                method: 'post'
+                uri: 'channels/testsuite-default-id/move'
+                params:
+                    app: 'multiple-args'
+                    appArgs: 'apples,bananas,carrots'
+        -
+            conditions:
+                match:
+                    type: StasisEnd
+                    application: one-arg
+            count: '1'
+        -
+            conditions:
+                match:
+                    type: StasisStart
+                    application: multiple-args
+                    args: ['apples','bananas','carrots']
+            count: '1'
+            requests:
+                method: 'delete'
+                uri: 'channels/testsuite-default-id'
+        -
+            conditions:
+                match:
+                    type: StasisEnd
+                    application: multiple-args
+            count: '1'
+
+properties:
+    dependencies:
+        - python : autobahn.websocket
+        - python : requests
+        - python : twisted
+        - python : starpy
+        - asterisk : res_ari_channels
+        - asterisk : app_echo
+    tags:
+        - ARI
diff --git a/tests/rest_api/tests.yaml b/tests/rest_api/tests.yaml
index ac9303c..8968f8f 100644
--- a/tests/rest_api/tests.yaml
+++ b/tests/rest_api/tests.yaml
@@ -17,3 +17,4 @@
     - dir:  'events'
     - dir:  'message'
     - dir:  'external_interaction'
+    - test: 'move'

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/10897
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 13
Gerrit-Change-Id: I83a2da829dc363727de8c7b56680d21692011e40
Gerrit-Change-Number: 10897
Gerrit-PatchSet: 2
Gerrit-Owner: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua C. Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190312/e26ce211/attachment.html>


More information about the asterisk-code-review mailing list