[Asterisk-code-review] tests/rest api/asterisk/config/dynamic: Add a test for push ... (testsuite[master])

Matt Jordan asteriskteam at digium.com
Fri Jul 17 09:24:16 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: tests/rest_api/asterisk/config/dynamic: Add a test for push config retrieval
......................................................................


tests/rest_api/asterisk/config/dynamic: Add a test for push config retrieval

This patch adds a test that covers push retrieval of a dynamic, aka,
'sorcery', configuration object. This includes both off-nominal and
nominal scenarios, including:
 - Off-nominal requests with bad path parameters
 - Off-nominal requests with an unknown dynamic object ID
 - Nominal retrieval of a previously created dynamic object
 - Nominal retrieval of an object statically created

ASTERISK-25238

Change-Id: If24fb98f264fb9918c42cdb8336556873a6f9c04
---
A tests/rest_api/asterisk/config/dynamic/get/configs/ast1/pjsip.conf
A tests/rest_api/asterisk/config/dynamic/get/configs/ast1/sorcery.conf
A tests/rest_api/asterisk/config/dynamic/get/test-config.yaml
M tests/rest_api/asterisk/config/dynamic/tests.yaml
4 files changed, 85 insertions(+), 0 deletions(-)

Approvals:
  Matt Jordan: Looks good to me, approved; Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/tests/rest_api/asterisk/config/dynamic/get/configs/ast1/pjsip.conf b/tests/rest_api/asterisk/config/dynamic/get/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..c46ae81
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/get/configs/ast1/pjsip.conf
@@ -0,0 +1,4 @@
+[alice]
+type=auth
+username=auth
+password=auth
diff --git a/tests/rest_api/asterisk/config/dynamic/get/configs/ast1/sorcery.conf b/tests/rest_api/asterisk/config/dynamic/get/configs/ast1/sorcery.conf
new file mode 100644
index 0000000..8b341df
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/get/configs/ast1/sorcery.conf
@@ -0,0 +1,2 @@
+[res_pjsip]
+endpoint=memory,ps_endpoints
diff --git a/tests/rest_api/asterisk/config/dynamic/get/test-config.yaml b/tests/rest_api/asterisk/config/dynamic/get/test-config.yaml
new file mode 100644
index 0000000..b25eeac
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/get/test-config.yaml
@@ -0,0 +1,78 @@
+testinfo:
+    summary: 'Test retrieval of a dynamic configuration objects'
+    description: |
+        'This test covers retrieving a dynamic config object using ARI.
+        This includes both off-nominal and nominal scenarios, specifically:
+        - Off-nominal requests with bad path parameters
+        - Off-nominal requests with an unknown dynamic object ID
+        - Nominal retrieval of a previously created dynamic object
+        - Nominal retrieval of an object statically created
+
+properties:
+    minversion: '13.5.0'
+    dependencies:
+        - python: autobahn.websocket
+        - python: requests
+        - python: twisted
+        - python: starpy
+        - asterisk: res_ari_asterisk
+        - asterisk: res_pjsip
+        - asterisk: res_sorcery_memory
+    tags:
+        - ARI
+        - pjsip
+
+test-modules:
+    test-object:
+        config-section: test-config
+        typename: ari.AriBaseTestObject
+    modules:
+        -
+            config-section: pluggable-config
+            typename: pluggable_modules.EventActionModule
+
+
+test-config:
+    apps: testsuite
+
+
+pluggable-config:
+    -
+        ari-start:
+        ari-requests:
+            -
+                method: 'put'
+                uri: 'asterisk/config/dynamic/res_pjsip/endpoint/alice'
+                body: { 'fields': [ { 'attribute': 'allow', 'value': '!all,ulaw,alaw' },
+                                    { 'attribute': 'auth', 'value': 'alice' } ] }
+                expect: 200
+            -
+                method: 'get'
+                uri: 'asterisk/BAD/dynamic/res_pjsip/endpoint/alice'
+                expect: 404
+            -
+                method: 'get'
+                uri: 'asterisk/config/BAD/res_pjsip/endpoint/alice'
+                expect: 404
+            -
+                method: 'get'
+                uri: 'asterisk/config/dynamic/BAD/endpoint/alice'
+                expect: 404
+            -
+                method: 'get'
+                uri: 'asterisk/config/dynamic/res_pjsip/BAD/alice'
+                expect: 404
+            -
+                method: 'get'
+                uri: 'asterisk/config/dynamic/res_pjsip/endpoint/bob'
+                expect: 404
+            -
+                method: 'get'
+                uri: 'asterisk/config/dynamic/res_pjsip/endpoint/alice'
+                expect: 200
+            -
+                method: 'get'
+                uri: 'asterisk/config/dynamic/res_pjsip/auth/alice'
+                expect: 200
+        stop_test:
+
diff --git a/tests/rest_api/asterisk/config/dynamic/tests.yaml b/tests/rest_api/asterisk/config/dynamic/tests.yaml
index b6c2112..0f30f9f 100644
--- a/tests/rest_api/asterisk/config/dynamic/tests.yaml
+++ b/tests/rest_api/asterisk/config/dynamic/tests.yaml
@@ -2,3 +2,4 @@
 tests:
     - test: 'create'
     - test: 'delete'
+    - test: 'get'

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If24fb98f264fb9918c42cdb8336556873a6f9c04
Gerrit-PatchSet: 3
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list