[Asterisk-code-review] rest api/events/variables: Add test for variables in ARI eve... (testsuite[master])

Sébastien Duthil asteriskteam at digium.com
Fri Nov 11 10:58:23 CST 2016


Sébastien Duthil has uploaded a new change for review. ( https://gerrit.asterisk.org/4400 )

Change subject: rest_api/events/variables: Add test for variables in ARI events.
......................................................................

rest_api/events/variables: Add test for variables in ARI events.

This test checks that channels variables are added to ARI channel
events, when configured properly in ari.conf.

ASTERISK-26492

Change-Id: Ida630f0fbb6aba97054e454f60e796cc623bd03d
---
M tests/rest_api/events/tests.yaml
A tests/rest_api/events/variables/configs/ast1/ari.conf
A tests/rest_api/events/variables/configs/ast1/extensions.conf
A tests/rest_api/events/variables/test-config.yaml
4 files changed, 120 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/00/4400/1

diff --git a/tests/rest_api/events/tests.yaml b/tests/rest_api/events/tests.yaml
index 2a76822..339a7d0 100644
--- a/tests/rest_api/events/tests.yaml
+++ b/tests/rest_api/events/tests.yaml
@@ -1,4 +1,5 @@
 # Enter tests here in the order they should be considered for execution:
 tests:
+    - test: 'variables'
     - test: 'subscribe-ws'
     - dir:  'user'
diff --git a/tests/rest_api/events/variables/configs/ast1/ari.conf b/tests/rest_api/events/variables/configs/ast1/ari.conf
new file mode 100644
index 0000000..bfe722e
--- /dev/null
+++ b/tests/rest_api/events/variables/configs/ast1/ari.conf
@@ -0,0 +1,8 @@
+[general]
+enabled = yes
+pretty = yes
+channelvars = CAN_YOU_SEE_ME,CHANNEL(language)
+
+[testsuite]
+type = user
+password = testsuite
diff --git a/tests/rest_api/events/variables/configs/ast1/extensions.conf b/tests/rest_api/events/variables/configs/ast1/extensions.conf
new file mode 100644
index 0000000..0714f2f
--- /dev/null
+++ b/tests/rest_api/events/variables/configs/ast1/extensions.conf
@@ -0,0 +1,7 @@
+[default]
+
+exten => s,1,NoOp()
+	same => n,Answer()
+	# same => n,Stasis(testsuite)
+	same => n,Wait(60)
+	same => n,Hangup()
diff --git a/tests/rest_api/events/variables/test-config.yaml b/tests/rest_api/events/variables/test-config.yaml
new file mode 100644
index 0000000..1a6c433
--- /dev/null
+++ b/tests/rest_api/events/variables/test-config.yaml
@@ -0,0 +1,104 @@
+testinfo:
+    summary: Test adding variables to ARI events
+    description: |
+        With some configuration in ari.conf, we:
+            1. create a channel
+            2. add it in a bridge
+            3. remove it from the bridge
+            4. hangup the channel
+        In each associated ARI event, check that the channel variables are still
+        present inside the event.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: ari.AriOriginateTestObject
+    modules:
+        -
+            config-section: ari-config
+            typename: ari.WebSocketEventModule
+
+test-object-config:
+    test-iterations:
+        -
+            endpoint: Local/s at default
+            channelId: testsuite-default-id
+            otherChannelId: testsuite-other-id
+            app: testsuite
+            json:
+                variables:
+                    CAN_YOU_SEE_ME: 'YES'
+                    CHANNEL(language): gobbledegook
+
+ari-config:
+    events:
+        -   conditions:
+                match:
+                    type: StasisStart
+                    application: testsuite
+                    channel:
+                        id: 'testsuite-default-id$'
+                        channelvars:
+                            CAN_YOU_SEE_ME: 'YES'
+                            CHANNEL(language): gobbledegook
+                    args: []
+            count: 1
+            requests:
+                -
+                    method: post
+                    uri: bridges
+                    params:
+                        bridgeId: testsuite-bridge-id
+                    expect: 200
+                -
+                    method: post
+                    uri: bridges/testsuite-bridge-id/addChannel
+                    params:
+                        channel: testsuite-default-id
+        -   conditions:
+                match:
+                    type: ChannelEnteredBridge
+                    channel:
+                        id: 'testsuite-default-id$'
+                        channelvars:
+                            CAN_YOU_SEE_ME: 'YES'
+                            CHANNEL(language): gobbledegook
+            requests:
+                method: post
+                uri: bridges/testsuite-bridge-id/removeChannel
+                params:
+                    channel: testsuite-default-id
+            count: 1
+        -   conditions:
+                match:
+                    type: ChannelLeftBridge
+                    channel:
+                        id: 'testsuite-default-id$'
+                        channelvars:
+                            CAN_YOU_SEE_ME: 'YES'
+                            CHANNEL(language): gobbledegook
+            requests:
+                method: delete
+                uri: channels/testsuite-default-id
+            count: 1
+        -   conditions:
+                match:
+                    type: StasisEnd
+                    application: testsuite
+                    channel:
+                        id: 'testsuite-default-id$'
+                        channelvars:
+                            CAN_YOU_SEE_ME: 'YES'
+                            CHANNEL(language): gobbledegook
+            count: 1
+
+properties:
+    minversion: '14.1.3'
+    dependencies:
+        - python : autobahn.websocket
+        - python : requests
+        - python : twisted
+        - python : starpy
+        - asterisk : res_ari_channels
+    tags:
+        - ARI

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ida630f0fbb6aba97054e454f60e796cc623bd03d
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Sébastien Duthil <sduthil at proformatique.com>



More information about the asterisk-code-review mailing list