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

N A asteriskteam at digium.com
Mon Dec 13 11:04:05 CST 2021


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


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

app_sf: Add tests for app_sf module

Adds tests for SendSF and ReceiveSF
applications and SF dial integration.

ASTERISK-29802

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



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/53/17653/1

diff --git a/tests/apps/sf/configs/ast1/extensions.conf b/tests/apps/sf/configs/ast1/extensions.conf
new file mode 100644
index 0000000..215974b
--- /dev/null
+++ b/tests/apps/sf/configs/ast1/extensions.conf
@@ -0,0 +1,43 @@
+
+[default]
+exten => s,1,Answer()
+	same => n,Set(GLOBAL(sendsf1)=111111)
+	same => n,Set(GLOBAL(sendsf2)=1234567890)
+	same => n,Set(GLOBAL(sendsf3)=4652544465)
+	same => n,Set(GLOBAL(sendsf4)=996512350)
+	same => n,Set(GLOBAL(sendsf5)=10104345)
+	same => n,Set(GLOBAL(sendsf6)=056863456)
+	same => n,Set(GLOBAL(sendsf7)=723503763)
+	same => n,Set(GLOBAL(sendsf8)=567565967)
+	same => n,Set(GLOBAL(sendsf9)=6565546)
+	same => n,Set(i=0)
+	same => n,While($[${INC(i)}<=8])
+	same => n,Originate(Local/${i}@send-sf,exten,receive-sf,${i},1,,a)
+	same => n,EndWhile()
+	same => n,Dial(Local/9 at receive-sf,,D(:::::${sendsf9}))
+	same => n,Hangup()
+
+[nothing]
+exten => 0,1,Answer()
+	same => n,Wait(15) ; enough time for sendsf9 to send. must be greater than ReceiveSF timeout.
+	same => n,Hangup()
+
+[send-sf]
+exten => _X!,1,Answer(0.5)
+	same => n,SendSF(${sendsf${EXTEN}})
+	same => n,Wait(44) ; needed so ReceiveSF has time to finish.
+	same => n,Hangup()
+
+[receive-sf]
+exten => _X!,1,Answer()
+	same => n,ReceiveSF(digits,${LEN(${sendsf${EXTEN}})})
+	same => n,GotoIf($["${digits}"="${sendsf${EXTEN}}"]?success,1:fail,1)
+exten => 9,1,Progress()
+	same => n,ReceiveSF(digits,,10)
+	same => n,GotoIf($["${digits}"="${sendsf${EXTEN}}"]?success,1:fail,1)
+exten => success,1,Answer(1)
+	same => n,UserEvent(ReceiveSFSuccess,Result: Pass)
+	same => n,Hangup()
+exten => fail,1,Answer(1)
+	same => n,UserEvent(ReceiveSFSuccess,Result: Fail ${RECEIVESFSTATUS} ${digits},Reason: ${digits})
+	same => n,Hangup()
diff --git a/tests/apps/sf/test-config.yaml b/tests/apps/sf/test-config.yaml
new file mode 100644
index 0000000..edd7b2f
--- /dev/null
+++ b/tests/apps/sf/test-config.yaml
@@ -0,0 +1,59 @@
+testinfo:
+    summary: 'Ensure that app_sf module functions correctly.'
+    description: |
+        'This tests the SendSF and ReceiveSF 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: 'ReceiveSFSuccess'
+            requirements:
+                match:
+                    Result: 'Pass'
+            count: 9
+        stop_test:
+
+properties:
+    tags:
+        - dial
+        - apps
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - asterisk: 'app_dial'
+        - asterisk: 'app_userevent'
+        - asterisk: 'app_originate'
+        - asterisk: 'app_sf'
+        - asterisk: 'pbx_config'
diff --git a/tests/apps/tests.yaml b/tests/apps/tests.yaml
index a00c9d1..dec3e1c 100644
--- a/tests/apps/tests.yaml
+++ b/tests/apps/tests.yaml
@@ -26,3 +26,4 @@
     - dir: 'statsd'
     - test: 'waitdigit'
     - dir: 'sendtext'
+    - test: 'sf'

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

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Change-Id: Ibc7ca3faed918a06917ef8f0e80fb0c565bb9c65
Gerrit-Change-Number: 17653
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/20211213/5baf30e0/attachment.html>


More information about the asterisk-code-review mailing list