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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 17 09:24:08 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 deletion
......................................................................


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

This patch adds a test that covers push deletion of a dynamic, aka,
'sorcery', configuration object. The test covers both off-nominal and
nominal scenarios, including:
 - Off-nominal requests with bad path parameters
 - Off-nominal requests to delete an unknown object
 - Off-nominal requests that attempt to delete a dynamic object
   that is not supported by the configuration
 - Nominal deletion of a previously created dynamic object

ASTERISK-25238

Change-Id: Ifb4b0d55a7c834136f5f3dfb6e36c71acddd2d2a
---
A tests/rest_api/asterisk/config/dynamic/delete/configs/ast1/pjsip.conf
A tests/rest_api/asterisk/config/dynamic/delete/configs/ast1/sorcery.conf
A tests/rest_api/asterisk/config/dynamic/delete/test-config.yaml
M tests/rest_api/asterisk/config/dynamic/tests.yaml
4 files changed, 98 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/delete/configs/ast1/pjsip.conf b/tests/rest_api/asterisk/config/dynamic/delete/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..c46ae81
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/delete/configs/ast1/pjsip.conf
@@ -0,0 +1,4 @@
+[alice]
+type=auth
+username=auth
+password=auth
diff --git a/tests/rest_api/asterisk/config/dynamic/delete/configs/ast1/sorcery.conf b/tests/rest_api/asterisk/config/dynamic/delete/configs/ast1/sorcery.conf
new file mode 100644
index 0000000..8b341df
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/delete/configs/ast1/sorcery.conf
@@ -0,0 +1,2 @@
+[res_pjsip]
+endpoint=memory,ps_endpoints
diff --git a/tests/rest_api/asterisk/config/dynamic/delete/test-config.yaml b/tests/rest_api/asterisk/config/dynamic/delete/test-config.yaml
new file mode 100644
index 0000000..1ebe0a8
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/delete/test-config.yaml
@@ -0,0 +1,91 @@
+testinfo:
+    summary: 'Test deletion of a dynamic configuration objects'
+    description: |
+        'This test covers deleting 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 to delete an unknown object
+        - Off-nominal requests that attempt to delete a dynamic object
+          that is not supported by the configuration
+        - Nominal deletion of a previously created dynamic object
+
+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': 'context', 'value': 'local' } ] }
+                expect: 200
+            -
+                method: 'get'
+                uri: 'asterisk/config/dynamic/res_pjsip/endpoint/alice'
+                expect: 200
+            -
+                method: 'delete'
+                uri: 'asterisk/BAD/dynamic/res_pjsip/endpoint/alice'
+                expect: 404
+            -
+                method: 'delete'
+                uri: 'asterisk/config/BAD/res_pjsip/endpoint/alice'
+                expect: 404
+            -
+                method: 'delete'
+                uri: 'asterisk/config/dynamic/BAD/endpoint/alice'
+                expect: 404
+            -
+                method: 'delete'
+                uri: 'asterisk/config/dynamic/res_pjsip/BAD/alice'
+                expect: 404
+            -
+                method: 'delete'
+                uri: 'asterisk/config/dynamic/res_pjsip/endpoint/bob'
+                expect: 404
+            -
+                method: 'delete'
+                uri: 'asterisk/config/dynamic/res_pjsip/endpoint/'
+                expect: 404
+            -
+                method: 'delete'
+                uri: 'asterisk/config/dynamic/res_pjsip/auth/alice'
+                expect: 403
+            -
+                method: 'delete'
+                uri: 'asterisk/config/dynamic/res_pjsip/endpoint/alice'
+                expect: 204
+            -
+                method: 'get'
+                uri: 'asterisk/config/dynamic/res_pjsip/endpoint/alice'
+                expect: 404
+        stop_test:
+
diff --git a/tests/rest_api/asterisk/config/dynamic/tests.yaml b/tests/rest_api/asterisk/config/dynamic/tests.yaml
index c338803..b6c2112 100644
--- a/tests/rest_api/asterisk/config/dynamic/tests.yaml
+++ b/tests/rest_api/asterisk/config/dynamic/tests.yaml
@@ -1,3 +1,4 @@
 # Enter tests here in the order they should be considered for execution:
 tests:
     - test: 'create'
+    - test: 'delete'

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifb4b0d55a7c834136f5f3dfb6e36c71acddd2d2a
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-commits mailing list