[asterisk-commits] kharwell: testsuite/asterisk/trunk r4442 - in /asterisk/trunk/tests/rest_api/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Dec 13 11:23:56 CST 2013


Author: kharwell
Date: Fri Dec 13 11:23:54 2013
New Revision: 4442

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4442
Log:
ARI: Allow specifying channel variables during a POST /channels

Test for originating a call with channel variables. Originates a call using ARI
and checks to make sure the specified channel variable(s) got set.

(issue ASTERISK-22872)
Reported by: Matt Jordan


Added:
    asterisk/trunk/tests/rest_api/channels/originate_with_vars/
    asterisk/trunk/tests/rest_api/channels/originate_with_vars/configs/
    asterisk/trunk/tests/rest_api/channels/originate_with_vars/configs/ast1/
    asterisk/trunk/tests/rest_api/channels/originate_with_vars/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/rest_api/channels/originate_with_vars/originate_with_vars.py   (with props)
    asterisk/trunk/tests/rest_api/channels/originate_with_vars/test-config.yaml   (with props)
Modified:
    asterisk/trunk/tests/rest_api/channels/tests.yaml

Added: asterisk/trunk/tests/rest_api/channels/originate_with_vars/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/originate_with_vars/configs/ast1/extensions.conf?view=auto&rev=4442
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/originate_with_vars/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/rest_api/channels/originate_with_vars/configs/ast1/extensions.conf Fri Dec 13 11:23:54 2013
@@ -1,0 +1,10 @@
+[default]
+
+exten => s,1,NoOp()
+	same => n,Answer()
+	same => n,Stasis(testsuite)
+	same => n,Hangup()
+
+exten => 1000,1,Answer()
+	same => n,Hangup()
+

Propchange: asterisk/trunk/tests/rest_api/channels/originate_with_vars/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/channels/originate_with_vars/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Propchange: asterisk/trunk/tests/rest_api/channels/originate_with_vars/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/rest_api/channels/originate_with_vars/originate_with_vars.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/originate_with_vars/originate_with_vars.py?view=auto&rev=4442
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/originate_with_vars/originate_with_vars.py (added)
+++ asterisk/trunk/tests/rest_api/channels/originate_with_vars/originate_with_vars.py Fri Dec 13 11:23:54 2013
@@ -1,0 +1,30 @@
+'''
+Copyright (C) 2013, Digium, Inc.
+Kevin Harwell <kharwell at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import json
+import requests
+
+def on_start(ari, event, obj):
+    url = ari.build_url('channels')
+
+    params = {
+        'endpoint': 'Local/1000 at default',
+        'app':'testsuite',
+        'appArgs': 'with_vars'}
+
+    data = {'CALLERID(name)': 'foo'}
+    headers = {'Content-type': 'application/json'}
+
+    resp = requests.post(url, params=params, data=json.dumps(data),
+                         headers=headers, auth=ari.userpass)
+
+    assert resp.json()['caller']['name'] == 'foo'
+    ari.delete('channels', resp.json()['id'])
+
+    ari.delete('channels', event['channel']['id'])
+    return True

Propchange: asterisk/trunk/tests/rest_api/channels/originate_with_vars/originate_with_vars.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/channels/originate_with_vars/originate_with_vars.py
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Propchange: asterisk/trunk/tests/rest_api/channels/originate_with_vars/originate_with_vars.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/rest_api/channels/originate_with_vars/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/originate_with_vars/test-config.yaml?view=auto&rev=4442
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/originate_with_vars/test-config.yaml (added)
+++ asterisk/trunk/tests/rest_api/channels/originate_with_vars/test-config.yaml Fri Dec 13 11:23:54 2013
@@ -1,0 +1,39 @@
+testinfo:
+    summary: Test originating call with channel variables.
+    description: |
+        Originates a call using ARI and checks to make sure the specified
+        channel variable(s) got set.
+
+test-modules:
+    add-test-to-search-path: True
+    test-object:
+        config-section: test-object-config
+        typename: ari.AriTestObject
+    modules:
+        -   config-section: ari-config
+            typename: ari.WebSocketEventModule
+
+ari-config:
+    apps: testsuite
+    events:
+        -   conditions:
+                match:
+                    type: StasisStart
+                    application: testsuite
+                    args: []
+            count: 1
+            callback:
+                module: originate_with_vars
+                method: on_start
+
+properties:
+    minversion: '12.0.0'
+    dependencies:
+        - python : autobahn.websocket
+        - python : requests
+        - python : twisted
+        - python : starpy
+        - asterisk : res_ari_channels
+        - asterisk : app_echo
+    tags:
+        - ARI

Propchange: asterisk/trunk/tests/rest_api/channels/originate_with_vars/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/channels/originate_with_vars/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Propchange: asterisk/trunk/tests/rest_api/channels/originate_with_vars/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/rest_api/channels/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/tests.yaml?view=diff&rev=4442&r1=4441&r2=4442
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/tests.yaml (original)
+++ asterisk/trunk/tests/rest_api/channels/tests.yaml Fri Dec 13 11:23:54 2013
@@ -1,4 +1,5 @@
 tests:
     - test: 'originate'
+    - test: 'originate_with_vars'
     - test: 'snoop_whisper'
     - test: 'snoop_spy'




More information about the asterisk-commits mailing list