[Asterisk-code-review] app_read: add tests for terminator only digit string. (testsuite[certified/18.9])
Michael Bradeen
asteriskteam at digium.com
Mon Feb 27 12:48:45 CST 2023
Michael Bradeen has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/19930 )
Change subject: app_read: add tests for terminator only digit string.
......................................................................
app_read: add tests for terminator only digit string.
Add tests to ensure that the 'e' option includes the terminator digit
on terminator digit only strings, and that no 'e' option does not.
ASTERISK-30411
Change-Id: Idd6d25cf83fa5d0a3e035f7a47ce2628486ea9e8
---
A tests/apps/read/configs/ast1/extensions.conf
A tests/apps/read/test-config.yaml
M tests/apps/tests.yaml
3 files changed, 141 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/30/19930/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..11bf876
--- /dev/null
+++ b/tests/apps/read/configs/ast1/extensions.conf
@@ -0,0 +1,67 @@
+
+[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(GLOBAL(senddtmf10)=#)
+ same => n,Set(GLOBAL(senddtmf11)=#)
+ same => n,Set(i=0)
+ same => n,While($[${INC(i)}<=11])
+ 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 => 10,1,Answer()
+ same => n,Read(digits)
+ same => n,GotoIf($["${digits}"=""]?success,1:fail,1)
+exten => 11,1,Answer()
+ same => n,Read(digits,,,e)
+ same => n,GotoIf($["${digits}"="#"]?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..722d53a
--- /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: 11
+ 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 a00c9d1..5ceae1c 100644
--- a/tests/apps/tests.yaml
+++ b/tests/apps/tests.yaml
@@ -26,3 +26,4 @@
- dir: 'statsd'
- test: 'waitdigit'
- dir: 'sendtext'
+ - test: 'read'
--
To view, visit https://gerrit.asterisk.org/c/testsuite/+/19930
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: testsuite
Gerrit-Branch: certified/18.9
Gerrit-Change-Id: Idd6d25cf83fa5d0a3e035f7a47ce2628486ea9e8
Gerrit-Change-Number: 19930
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20230227/97936337/attachment-0001.html>
More information about the asterisk-code-review
mailing list