[Asterisk-code-review] app_mf: Add tests for app_mf module (testsuite[master])

N A asteriskteam at digium.com
Sat Dec 4 13:27:48 CST 2021


N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/17593 )


Change subject: app_mf: Add tests for app_mf module
......................................................................

app_mf: Add tests for app_mf module

Adds tests for the following functionality:
- SendMF application
- ReceiveMF application
- Dial D MF option

Change-Id: I95a20b869933afc3fb43b6f31e81811d3a913494
---
A tests/apps/mf/configs/ast1/extensions.conf
A tests/apps/mf/test-config.yaml
M tests/apps/tests.yaml
3 files changed, 104 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/93/17593/1

diff --git a/tests/apps/mf/configs/ast1/extensions.conf b/tests/apps/mf/configs/ast1/extensions.conf
new file mode 100644
index 0000000..5093bbb
--- /dev/null
+++ b/tests/apps/mf/configs/ast1/extensions.conf
@@ -0,0 +1,44 @@
+
+[default]
+
+[default]
+exten => s,1,Answer()
+	same => n,MSet(GLOBAL(sendmf1)=*123#)
+	same => n,MSet(GLOBAL(sendmf2)=*123A)
+	same => n,MSet(GLOBAL(sendmf3)=**123#)
+	same => n,MSet(GLOBAL(sendmf4)=*1254*123#)
+	same => n,MSet(GLOBAL(sendmf5)=*009####)
+	same => n,Set(i=0)
+	same => n,While($[${INC(i)}<=5])
+	same => n,Originate(Local/${i}@send-mf,exten,receive-mf,${i},1,,a)
+	same => n,EndWhile()
+	same => n,Dial(Local/6 at receive-mf,,D(:::*987#))
+	same => n,Hangup()
+
+[nothing]
+exten => 0,1,Answer()
+	same => n,Wait(8)
+	same => n,Hangup()
+
+[send-mf]
+exten => _X!,1,Answer(0.5)
+	same => n,SendMF(${sendmf${EXTEN}})
+	same => n,Wait(99) ; needed so ReceiveMF has time to finish.
+	same => n,Hangup()
+
+[receive-mf]
+exten => _X!,1,Answer()
+	same => n,ReceiveMF(digits)
+	same => n,GotoIf($["${digits}"="${sendmf${EXTEN}}"]?success,1:fail,1)
+exten => 5,1,Answer()
+	same => n,ReceiveMF(digits)
+	same => n,GotoIf($["${digits}"="*009#"]?success,1:fail,1)
+exten => 6,1,Progress()
+	same => n,ReceiveMF(digits,,kos)
+	same => n,GotoIf($["${digits}"="987"]?success,1:fail,1)
+exten => success,1,Answer(1)
+	same => n,UserEvent(ReceiveMFSuccess,Result: Pass)
+	same => n,Hangup()
+exten => fail,1,Answer(1)
+	same => n,UserEvent(ReceiveMFSuccess,Result: Fail ${RECEIVEMFSTATUS} ${digits},Reason: ${digits})
+	same => n,Hangup()
diff --git a/tests/apps/mf/test-config.yaml b/tests/apps/mf/test-config.yaml
new file mode 100644
index 0000000..83b2fda
--- /dev/null
+++ b/tests/apps/mf/test-config.yaml
@@ -0,0 +1,59 @@
+testinfo:
+    summary: 'Ensure that app_mf module functions correctly.'
+    description: |
+        'This tests the SendMF and ReceiveMF applications as
+        well as Dial D option work correctly.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'test_case.TestCaseModule'
+    modules:
+        -
+            config-section: caller-originator
+            typename: 'pluggable_modules.Originator'
+        -
+            config-section: hangup-monitor
+            typename: 'pluggable_modules.HangupMonitor'
+        -
+            config-section: ami-config
+            typename: 'pluggable_modules.EventActionModule'
+
+test-object-config:
+    connect-ami: True
+
+caller-originator:
+    channel: 'Local/s at default'
+    context: 'nothing'
+    exten: '0'
+    priority: '1'
+    trigger: 'ami_connect'
+
+hangup-monitor:
+    ids: '0'
+
+ami-config:
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'UserEvent'
+                    UserEvent: 'ReceiveMFSuccess'
+            requirements:
+                match:
+                    Result: 'Pass'
+            count: 6
+        stop_test:
+
+properties:
+    tags:
+        - dial
+        - apps
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - asterisk: 'app_dial'
+        - asterisk: 'app_userevent'
+        - asterisk: 'app_originate'
+        - asterisk: 'app_mf'
+        - asterisk: 'pbx_config'
diff --git a/tests/apps/tests.yaml b/tests/apps/tests.yaml
index a00c9d1..4f15191 100644
--- a/tests/apps/tests.yaml
+++ b/tests/apps/tests.yaml
@@ -26,3 +26,4 @@
     - dir: 'statsd'
     - test: 'waitdigit'
     - dir: 'sendtext'
+    - test: 'mf'

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

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Change-Id: I95a20b869933afc3fb43b6f31e81811d3a913494
Gerrit-Change-Number: 17593
Gerrit-PatchSet: 1
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20211204/716245db/attachment.html>


More information about the asterisk-code-review mailing list