[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:26 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 updates
......................................................................
tests/rest_api/asterisk/config/dynamic: Add a test for push config updates
This patch adds a test that covers push updating of a dynamic, aka,
'sorcery', configuration object. The test covers both nominal and
off-nominal scenarios, including:
- Off-nominal requests with bad path parameters
- Off-nominal requests with no provided attributes to update
- Off-nominal requests with invalid provided attributes
- Off-nominal requests that attempt to update a dynamic object
that is not supported by the configuration
- Nominal updating of a previously created dynamic object
ASTERISK-25238
Change-Id: I98368d4c6490da4328952b14b183b9d5a56ef26f
---
M tests/rest_api/asterisk/config/dynamic/tests.yaml
A tests/rest_api/asterisk/config/dynamic/update/configs/ast1/pjsip.conf
A tests/rest_api/asterisk/config/dynamic/update/configs/ast1/sorcery.conf
A tests/rest_api/asterisk/config/dynamic/update/test-config.yaml
4 files changed, 108 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/tests.yaml b/tests/rest_api/asterisk/config/dynamic/tests.yaml
index 0f30f9f..c95658f 100644
--- a/tests/rest_api/asterisk/config/dynamic/tests.yaml
+++ b/tests/rest_api/asterisk/config/dynamic/tests.yaml
@@ -3,3 +3,4 @@
- test: 'create'
- test: 'delete'
- test: 'get'
+ - test: 'update'
diff --git a/tests/rest_api/asterisk/config/dynamic/update/configs/ast1/pjsip.conf b/tests/rest_api/asterisk/config/dynamic/update/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..c46ae81
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/update/configs/ast1/pjsip.conf
@@ -0,0 +1,4 @@
+[alice]
+type=auth
+username=auth
+password=auth
diff --git a/tests/rest_api/asterisk/config/dynamic/update/configs/ast1/sorcery.conf b/tests/rest_api/asterisk/config/dynamic/update/configs/ast1/sorcery.conf
new file mode 100644
index 0000000..8b341df
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/update/configs/ast1/sorcery.conf
@@ -0,0 +1,2 @@
+[res_pjsip]
+endpoint=memory,ps_endpoints
diff --git a/tests/rest_api/asterisk/config/dynamic/update/test-config.yaml b/tests/rest_api/asterisk/config/dynamic/update/test-config.yaml
new file mode 100644
index 0000000..8a8898d
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/update/test-config.yaml
@@ -0,0 +1,101 @@
+testinfo:
+ summary: 'Test updating of a dynamic configuration objects'
+ description: |
+ 'This test covers updating 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 no provided attributes to update
+ - Off-nominal requests with invalid provided attributes
+ - Off-nominal requests that attempt to update a dynamic object
+ that is not supported by the configuration
+ - Nominal updating 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: 'put'
+ uri: 'asterisk/BAD/dynamic/res_pjsip/endpoint/alice'
+ body: { 'fields': [ { 'attribute': 'allow', 'value': '!all,ulaw,alaw' },
+ { 'attribute': 'context', 'value': 'local' } ] }
+ expect: 404
+ -
+ method: 'put'
+ uri: 'asterisk/config/BAD/res_pjsip/endpoint/alice'
+ body: { 'fields': [ { 'attribute': 'allow', 'value': '!all,ulaw,alaw' },
+ { 'attribute': 'context', 'value': 'local' } ] }
+ expect: 404
+ -
+ method: 'put'
+ uri: 'asterisk/config/dynamic/BAD/endpoint/alice'
+ body: { 'fields': [ { 'attribute': 'allow', 'value': '!all,ulaw,alaw' },
+ { 'attribute': 'context', 'value': 'local' } ] }
+ expect: 404
+ -
+ method: 'put'
+ uri: 'asterisk/config/dynamic/res_pjsip/BAD/alice'
+ body: { 'fields': [ { 'attribute': 'allow', 'value': '!all,ulaw,alaw' },
+ { 'attribute': 'context', 'value': 'local' } ] }
+ expect: 404
+ -
+ method: 'put'
+ uri: 'asterisk/config/dynamic/res_pjsip/endpoint/alice'
+ body: { 'fields': [ { 'attribute': 'allow', 'value': 'BLECH' },
+ { 'attribute': 'context', 'value': 'local' } ] }
+ expect: 400
+ -
+ method: 'put'
+ uri: 'asterisk/config/dynamic/res_pjsip/endpoint/alice'
+ expect: 400
+ -
+ method: 'put'
+ uri: 'asterisk/config/dynamic/res_pjsip/auth/alice'
+ body: { 'fields': [ { 'attribute': 'username', 'value': 'bob' } ] }
+ expect: 403
+ -
+ method: 'put'
+ uri: 'asterisk/config/dynamic/res_pjsip/endpoint/alice'
+ body: { 'fields': [ { 'attribute': 'context', 'value': 'remote' },
+ { 'attribute': 'auth', 'value': 'alice' } ] }
+ expect: 200
+ -
+ method: 'get'
+ uri: 'asterisk/config/dynamic/res_pjsip/endpoint/alice'
+ expect: 200
+ stop_test:
+
--
To view, visit https://gerrit.asterisk.org/846
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I98368d4c6490da4328952b14b183b9d5a56ef26f
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