[Asterisk-code-review] app_read: Add tests for Read application (testsuite[19])
George Joseph
asteriskteam at digium.com
Wed Dec 15 14:34:53 CST 2021
George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/17728 )
Change subject: app_read: Add tests for Read application
......................................................................
app_read: Add tests for Read application
Adds tests for the Read application to ensure
proper behavior and option functionality.
ASTERISK-29705
Change-Id: I95408f229cc7e476001019b9e47e9409283fa7f0
---
A tests/apps/read/configs/ast1/extensions.conf
A tests/apps/read/test-config.yaml
M tests/apps/tests.yaml
3 files changed, 119 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/28/17728/1
diff --git a/tests/apps/read/configs/ast1/extensions.conf b/tests/apps/read/configs/ast1/extensions.conf
new file mode 100644
index 0000000..7fd4b53
--- /dev/null
+++ b/tests/apps/read/configs/ast1/extensions.conf
@@ -0,0 +1,59 @@
+
+[default]
+exten => s,1,Answer()
+ same => n,Set(GLOBAL(senddtmf1)=*123#DB)
+ same => n,Set(GLOBAL(senddtmf2)=*123A#2#DB)
+ same => n,Set(GLOBAL(senddtmf3)=**123#DC)
+ same => n,Set(GLOBAL(senddtmf4)=*1254*123#DD)
+ same => n,Set(GLOBAL(senddtmf5)=*009)
+ same => n,Set(GLOBAL(senddtmf6)=*009####)
+ same => n,Set(GLOBAL(senddtmf7)=1234#56)
+ same => n,Set(GLOBAL(senddtmf8)=1234#56)
+ same => n,Set(GLOBAL(senddtmf9)=9876#56)
+ same => n,Set(i=0)
+ same => n,While($[${INC(i)}<=9])
+ same => n,Originate(Local/${i}@send-dtmf,exten,read-dtmf,${i},1,,a)
+ same => n,EndWhile()
+ same => n,Hangup()
+
+[nothing]
+exten => 0,1,Answer()
+ same => n,Wait(8)
+ same => n,Hangup()
+
+[send-dtmf]
+exten => _X!,1,Answer(0.5)
+ same => n,SendDTMF(${senddtmf${EXTEN}})
+ same => n,Wait(15) ; needed so Read has time to finish.
+ same => n,Hangup()
+
+[read-dtmf]
+exten => _[1-4],1,Answer()
+ same => n,Set(TIMEOUT(response)=3)
+ same => n,Read(digits,,,t(D))
+ same => n,GotoIf($["${digits}"="${senddtmf${EXTEN}:0:-2}"]?success,1:fail,1)
+exten => 5,1,Answer()
+ same => n,Set(TIMEOUT(response)=3)
+ same => n,Read(digits) ; normal
+ same => n,GotoIf($["${digits}"="*009"]?success,1:fail,1)
+exten => 6,1,Answer()
+ same => n,Set(TIMEOUT(response)=3)
+ same => n,Read(digits,,8,t) ; no terminator at all
+ same => n,GotoIf($["${digits}"="*009####"]?success,1:fail,1)
+exten => 7,1,Answer()
+ same => n,Set(TIMEOUT(response)=3)
+ same => n,Read(digits,dial,,it(#))
+ same => n,GotoIf($["${digits}"="${senddtmf${EXTEN}:0:-3}"]?success,1:fail,1)
+exten => 8,1,Answer()
+ same => n,Set(TIMEOUT(response)=3)
+ same => n,Read(digits,dial,7,it)
+ same => n,GotoIf($["${digits}"="${senddtmf${EXTEN}}"]?success,1:fail,1)
+exten => 9,1,Answer()
+ same => n,Read(digits,dial,,i)
+ same => n,GotoIf($["${digits}"="${senddtmf${EXTEN}:0:4}"]?success,1:fail,1)
+exten => success,1,Answer(1)
+ same => n,UserEvent(ReadSuccess,Result: Pass)
+ same => n,Hangup()
+exten => fail,1,Answer(1)
+ same => n,UserEvent(ReadFailure,Result: Fail ${digits},Reason: ${digits})
+ same => n,Hangup()
diff --git a/tests/apps/read/test-config.yaml b/tests/apps/read/test-config.yaml
new file mode 100644
index 0000000..6dba4ee
--- /dev/null
+++ b/tests/apps/read/test-config.yaml
@@ -0,0 +1,59 @@
+testinfo:
+ summary: 'Ensure that app_read options work correctly.'
+ description: |
+ 'This tests options in the Read application to
+ ensure that it functions 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: 'ReadSuccess'
+ 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_read'
+ - asterisk: 'pbx_config'
diff --git a/tests/apps/tests.yaml b/tests/apps/tests.yaml
index 4f15191..5b59498 100644
--- a/tests/apps/tests.yaml
+++ b/tests/apps/tests.yaml
@@ -27,3 +27,4 @@
- test: 'waitdigit'
- dir: 'sendtext'
- test: 'mf'
+ - test: 'read'
--
To view, visit https://gerrit.asterisk.org/c/testsuite/+/17728
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: testsuite
Gerrit-Branch: 19
Gerrit-Change-Id: I95408f229cc7e476001019b9e47e9409283fa7f0
Gerrit-Change-Number: 17728
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-CC: 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/20211215/6e4ff4eb/attachment.html>
More information about the asterisk-code-review
mailing list