[Asterisk-code-review] manager: add test for file outside config directory (testsuite[20])

Friendly Automation asteriskteam at digium.com
Tue Dec 20 07:11:27 CST 2022


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/testsuite/+/19689 )

Change subject: manager: add test for file outside config directory
......................................................................

manager: add test for file outside config directory

Add negative test that looks for correct error on read of
file outside AST_CONFIG_DIR

ASTERISK-30176

Change-Id: I49d0daf31043bcb7483b0003619e0bc5568141f9
---
A tests/manager/config/restricted/test-config.yaml
M tests/manager/config/tests.yaml
2 files changed, 82 insertions(+), 0 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit




diff --git a/tests/manager/config/restricted/test-config.yaml b/tests/manager/config/restricted/test-config.yaml
new file mode 100644
index 0000000..f37e1a9
--- /dev/null
+++ b/tests/manager/config/restricted/test-config.yaml
@@ -0,0 +1,67 @@
+testinfo:
+    summary:    'Test Manager GetConfig and UpdateConfig Basic Ops'
+    description: |
+        'Test Manager GetConfig and UpdateConfig Basic Ops'
+properties:
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+    tags:
+        - manager
+        - AMI
+
+test-modules:
+    add-test-to-search-path: 'True'
+    add-relative-to-search-path: ['..']
+    test-object:
+        config-section: object-config
+        typename: 'ManagerConfigTest.ManagerConfigTest'
+
+ast-config-options:
+    live_dangerously: 'no'
+
+object-config:
+    reactor-timeout: 15
+    ami-config:
+        - ###  Create a new config file outside the asterisk config directory
+            message:
+                Action: 'GetConfig'
+                Filename: '/tmp/test.conf'
+            expected:
+                Response: 'Error'
+                Message: 'File requires escalated priveledges'
+        - ###  Update a config file outside the asterisk config directory
+            message:
+                Action: 'UpdateConfig'
+                SrcFilename: '/tmp/test.conf'
+                DstFilename: '/tmp/test.conf'
+
+                Action-000000: 'NewCat'
+                Cat-000000: 'Cat1'
+            expected:
+                Response: 'Error'
+                Message: 'File requires escalated priveledges'
+        - ###  Update from a config file outside the asterisk config directory
+            message:
+                Action: 'UpdateConfig'
+                SrcFilename: '/tmp/test.conf'
+                DstFilename: 'test.conf'
+
+                Action-000000: 'NewCat'
+                Cat-000000: 'Cat1'
+            expected:
+                Response: 'Error'
+                Message: 'File requires escalated priveledges'
+        - ###  Update to a config file outside the asterisk config directory
+            message:
+                Action: 'UpdateConfig'
+                SrcFilename: 'test.conf'
+                DstFilename: '/tmp/test.conf'
+
+                Action-000000: 'NewCat'
+                Cat-000000: 'Cat1'
+            expected:
+                Response: 'Error'
+                Message: 'File requires escalated priveledges'
+
+
diff --git a/tests/manager/config/tests.yaml b/tests/manager/config/tests.yaml
index 9ddadda..45cacc8 100644
--- a/tests/manager/config/tests.yaml
+++ b/tests/manager/config/tests.yaml
@@ -2,4 +2,5 @@
 tests:
     - test: 'basic'
     - test: 'advanced'
+    - test: 'restricted'
     - test: 'no_preserve_effective_context'

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/19689
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 20
Gerrit-Change-Id: I49d0daf31043bcb7483b0003619e0bc5568141f9
Gerrit-Change-Number: 19689
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221220/53bd4855/attachment-0001.html>


More information about the asterisk-code-review mailing list