[Asterisk-code-review] apps/dial/privacy/privacy: Add a test for the 'torture' menu... (testsuite[master])

Matt Jordan asteriskteam at digium.com
Sat Sep 3 15:59:52 CDT 2016


Matt Jordan has uploaded a new change for review.

  https://gerrit.asterisk.org/3815

Change subject: apps/dial/privacy/privacy: Add a test for the 'torture' menu option
......................................................................

apps/dial/privacy/privacy: Add a test for the 'torture' menu option

This patch adds a test for the privacy (P) option for the Dial application,
in which the callee decides to banish the caller forever to a 'torture'
menu. The test verifies that the caller is ejected with the appropriate
DIALSTATUS, and that a subsequent call attempt by the caller is immediately
ejected out of the Dial application without an attempt being made to reach
the callee.

ASTERISK-25691

Change-Id: Ib089169adb213b707707448c60e8025842183a35
---
M tests/apps/dial/privacy/privacy/tests.yaml
A tests/apps/dial/privacy/privacy/torture/test-config.yaml
2 files changed, 209 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/15/3815/1

diff --git a/tests/apps/dial/privacy/privacy/tests.yaml b/tests/apps/dial/privacy/privacy/tests.yaml
index 1be640e..ccadfac 100644
--- a/tests/apps/dial/privacy/privacy/tests.yaml
+++ b/tests/apps/dial/privacy/privacy/tests.yaml
@@ -3,3 +3,4 @@
     - test: 'connect-call'
     - test: 'forever-vm'
     - test: 'go-away'
+    - test: 'torture'
diff --git a/tests/apps/dial/privacy/privacy/torture/test-config.yaml b/tests/apps/dial/privacy/privacy/torture/test-config.yaml
new file mode 100644
index 0000000..823e8a3
--- /dev/null
+++ b/tests/apps/dial/privacy/privacy/torture/test-config.yaml
@@ -0,0 +1,208 @@
+testinfo:
+    summary: 'Test Privacy where the calling party is sent to a torture menu'
+    description: |
+        'This test covers the privacy option (P) where the called
+        party chooses to send the calling party to the torture menu.
+        The test verifies some basic properties of the
+        Privacy mode, including the recording of the name of the caller,
+        along with the resulting DIALSTATUS.
+
+        Once the Caller ID has been banned, a second attempt is made. The
+        test verifies that it immediately gets bounced out again to torture.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: apptest.AppTest
+    modules:
+        -
+            config-section: asterisk-config
+            typename: pluggable_modules.AsteriskConfigModule
+
+asterisk-config:
+    -
+        src: 'tests/apps/dial/privacy/configs/extensions.conf'
+        dst: 'extensions.conf'
+
+test-object-config:
+  app: 'Dial'
+  scenarios:
+    -
+      channels:
+        -
+          channel-id: 'Test-User'
+          channel-name: 'Local/test_privacy at default'
+          context: 'default'
+          exten: 'wait'
+          start-on-create: True
+          events:
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Newexten'
+                  Context: 'default'
+                  Extension: 'wait'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'TestEvent'
+                  State: 'PLAYBACK'
+                  Message: 'beep'
+              actions:
+                -
+                  action-type: 'stream-audio-with-dtmf'
+                  sound-file: 'agent-loginok'
+                  dtmf: '#'
+                  dtmf-delay: 4
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'TestEvent'
+                  State: 'PLAYBACK'
+                  Message: 'vm-dialout'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Dial out commencing and announced'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'BridgeEnter'
+                  Channel: 'Local/test_privacy at default-00000000;2'
+              actions:
+                -
+                  action-type: 'fail-test'
+                  message: 'Bridge of test_privacy half occurred when they should have gone to VM'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'UserEvent'
+                  UserEvent: 'DialStatus'
+                  Result: 'TORTURE'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'DIALSTATUS is TORTURE'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Hangup'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Channel test_privacy hungup'
+                -
+                  action-type: 'start-call'
+                  channel-id: 'Test-User2'
+        -
+          # This channel is dialed; as a result, we don't control
+          # it when it goes into an application. Instead, channel
+          # variables set in the dialplan will inform apptest that
+          # it can be controlled
+          channel-id: 'Farend'
+          channel-name: 'Local/farend at default'
+          testuniqueid: 'farend'
+          events:
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'TestEvent'
+                  State: 'PLAYBACK'
+                  Message: 'priv-callerintros/5551234.*'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Calling party name played to called party'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'TestEvent'
+                  State: 'PLAYBACK'
+                  Message: 'priv-callee-options'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Options played to far end'
+                -
+                  action-type: 'send-dtmf'
+                  delay: 1
+                  dtmf: '3'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'BridgeEnter'
+                  Channel: 'Local/farend at default-00000001;1'
+              actions:
+                -
+                  action-type: 'fail-test'
+                  message: 'Bridge of farend half occurred when it should have hung up'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Hangup'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Channel farend hungup'
+        -
+          channel-id: 'Test-User2'
+          channel-name: 'Local/test_privacy at default'
+          context: 'default'
+          exten: 'wait'
+          ignore-until-started: True
+          events:
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'TestEvent'
+                  State: 'PLAYBACK'
+                  Message: 'beep'
+              actions:
+                -
+                  action-type: 'fail-test'
+                  expected-result: 'Dial should have been blocked but we got asked to record our name'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'UserEvent'
+                  UserEvent: 'DialStatus'
+                  Result: 'TORTURE'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'DIALSTATUS is TORTURE'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Hangup'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Channel test_privacy hungup a second time'
+
+
+properties:
+    minversion: '13.12.0'
+    tags:
+      - apps
+      - dial
+    dependencies:
+      - buildoption: 'TEST_FRAMEWORK'
+      - python : 'twisted'
+      - python : 'starpy'
+      - asterisk : 'app_senddtmf'
+      - asterisk : 'app_dial'
+

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib089169adb213b707707448c60e8025842183a35
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list