<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/testsuite/+/17728">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_read: Add tests for Read application<br><br>Adds tests for the Read application to ensure<br>proper behavior and option functionality.<br><br>ASTERISK-29705<br><br>Change-Id: I95408f229cc7e476001019b9e47e9409283fa7f0<br>---<br>A tests/apps/read/configs/ast1/extensions.conf<br>A tests/apps/read/test-config.yaml<br>M tests/apps/tests.yaml<br>3 files changed, 119 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/28/17728/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/tests/apps/read/configs/ast1/extensions.conf b/tests/apps/read/configs/ast1/extensions.conf</span><br><span>new file mode 100644</span><br><span>index 0000000..7fd4b53</span><br><span>--- /dev/null</span><br><span>+++ b/tests/apps/read/configs/ast1/extensions.conf</span><br><span>@@ -0,0 +1,59 @@</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[default]</span><br><span style="color: hsl(120, 100%, 40%);">+exten => s,1,Answer()</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Set(GLOBAL(senddtmf1)=*123#DB)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Set(GLOBAL(senddtmf2)=*123A#2#DB)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Set(GLOBAL(senddtmf3)=**123#DC)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Set(GLOBAL(senddtmf4)=*1254*123#DD)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Set(GLOBAL(senddtmf5)=*009)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Set(GLOBAL(senddtmf6)=*009####)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Set(GLOBAL(senddtmf7)=1234#56)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Set(GLOBAL(senddtmf8)=1234#56)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Set(GLOBAL(senddtmf9)=9876#56)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Set(i=0)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,While($[${INC(i)}<=9])</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Originate(Local/${i}@send-dtmf,exten,read-dtmf,${i},1,,a)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,EndWhile()</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Hangup()</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[nothing]</span><br><span style="color: hsl(120, 100%, 40%);">+exten => 0,1,Answer()</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Wait(8)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Hangup()</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[send-dtmf]</span><br><span style="color: hsl(120, 100%, 40%);">+exten => _X!,1,Answer(0.5)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,SendDTMF(${senddtmf${EXTEN}})</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Wait(15) ; needed so Read has time to finish.</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Hangup()</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[read-dtmf]</span><br><span style="color: hsl(120, 100%, 40%);">+exten => _[1-4],1,Answer()</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Set(TIMEOUT(response)=3)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Read(digits,,,t(D))</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,GotoIf($["${digits}"="${senddtmf${EXTEN}:0:-2}"]?success,1:fail,1)</span><br><span style="color: hsl(120, 100%, 40%);">+exten => 5,1,Answer()</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Set(TIMEOUT(response)=3)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Read(digits) ; normal</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,GotoIf($["${digits}"="*009"]?success,1:fail,1)</span><br><span style="color: hsl(120, 100%, 40%);">+exten => 6,1,Answer()</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Set(TIMEOUT(response)=3)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Read(digits,,8,t) ; no terminator at all</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,GotoIf($["${digits}"="*009####"]?success,1:fail,1)</span><br><span style="color: hsl(120, 100%, 40%);">+exten => 7,1,Answer()</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Set(TIMEOUT(response)=3)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Read(digits,dial,,it(#))</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,GotoIf($["${digits}"="${senddtmf${EXTEN}:0:-3}"]?success,1:fail,1)</span><br><span style="color: hsl(120, 100%, 40%);">+exten => 8,1,Answer()</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Set(TIMEOUT(response)=3)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Read(digits,dial,7,it)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,GotoIf($["${digits}"="${senddtmf${EXTEN}}"]?success,1:fail,1)</span><br><span style="color: hsl(120, 100%, 40%);">+exten => 9,1,Answer()</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Read(digits,dial,,i)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,GotoIf($["${digits}"="${senddtmf${EXTEN}:0:4}"]?success,1:fail,1)</span><br><span style="color: hsl(120, 100%, 40%);">+exten => success,1,Answer(1)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,UserEvent(ReadSuccess,Result: Pass)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Hangup()</span><br><span style="color: hsl(120, 100%, 40%);">+exten => fail,1,Answer(1)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,UserEvent(ReadFailure,Result: Fail ${digits},Reason: ${digits})</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Hangup()</span><br><span>diff --git a/tests/apps/read/test-config.yaml b/tests/apps/read/test-config.yaml</span><br><span>new file mode 100644</span><br><span>index 0000000..6dba4ee</span><br><span>--- /dev/null</span><br><span>+++ b/tests/apps/read/test-config.yaml</span><br><span>@@ -0,0 +1,59 @@</span><br><span style="color: hsl(120, 100%, 40%);">+testinfo:</span><br><span style="color: hsl(120, 100%, 40%);">+ summary: 'Ensure that app_read options work correctly.'</span><br><span style="color: hsl(120, 100%, 40%);">+ description: |</span><br><span style="color: hsl(120, 100%, 40%);">+ 'This tests options in the Read application to</span><br><span style="color: hsl(120, 100%, 40%);">+ ensure that it functions correctly.'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+test-modules:</span><br><span style="color: hsl(120, 100%, 40%);">+ test-object:</span><br><span style="color: hsl(120, 100%, 40%);">+ config-section: test-object-config</span><br><span style="color: hsl(120, 100%, 40%);">+ typename: 'test_case.TestCaseModule'</span><br><span style="color: hsl(120, 100%, 40%);">+ modules:</span><br><span style="color: hsl(120, 100%, 40%);">+ -</span><br><span style="color: hsl(120, 100%, 40%);">+ config-section: caller-originator</span><br><span style="color: hsl(120, 100%, 40%);">+ typename: 'pluggable_modules.Originator'</span><br><span style="color: hsl(120, 100%, 40%);">+ -</span><br><span style="color: hsl(120, 100%, 40%);">+ config-section: hangup-monitor</span><br><span style="color: hsl(120, 100%, 40%);">+ typename: 'pluggable_modules.HangupMonitor'</span><br><span style="color: hsl(120, 100%, 40%);">+ -</span><br><span style="color: hsl(120, 100%, 40%);">+ config-section: ami-config</span><br><span style="color: hsl(120, 100%, 40%);">+ typename: 'pluggable_modules.EventActionModule'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+test-object-config:</span><br><span style="color: hsl(120, 100%, 40%);">+ connect-ami: True</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+caller-originator:</span><br><span style="color: hsl(120, 100%, 40%);">+ channel: 'Local/s@default'</span><br><span style="color: hsl(120, 100%, 40%);">+ context: 'nothing'</span><br><span style="color: hsl(120, 100%, 40%);">+ exten: '0'</span><br><span style="color: hsl(120, 100%, 40%);">+ priority: '1'</span><br><span style="color: hsl(120, 100%, 40%);">+ trigger: 'ami_connect'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+hangup-monitor:</span><br><span style="color: hsl(120, 100%, 40%);">+ ids: '0'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ami-config:</span><br><span style="color: hsl(120, 100%, 40%);">+ -</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-events:</span><br><span style="color: hsl(120, 100%, 40%);">+ conditions:</span><br><span style="color: hsl(120, 100%, 40%);">+ match:</span><br><span style="color: hsl(120, 100%, 40%);">+ Event: 'UserEvent'</span><br><span style="color: hsl(120, 100%, 40%);">+ UserEvent: 'ReadSuccess'</span><br><span style="color: hsl(120, 100%, 40%);">+ requirements:</span><br><span style="color: hsl(120, 100%, 40%);">+ match:</span><br><span style="color: hsl(120, 100%, 40%);">+ Result: 'Pass'</span><br><span style="color: hsl(120, 100%, 40%);">+ count: 9</span><br><span style="color: hsl(120, 100%, 40%);">+ stop_test:</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+properties:</span><br><span style="color: hsl(120, 100%, 40%);">+ tags:</span><br><span style="color: hsl(120, 100%, 40%);">+ - dial</span><br><span style="color: hsl(120, 100%, 40%);">+ - apps</span><br><span style="color: hsl(120, 100%, 40%);">+ dependencies:</span><br><span style="color: hsl(120, 100%, 40%);">+ - python: 'twisted'</span><br><span style="color: hsl(120, 100%, 40%);">+ - python: 'starpy'</span><br><span style="color: hsl(120, 100%, 40%);">+ - asterisk: 'app_dial'</span><br><span style="color: hsl(120, 100%, 40%);">+ - asterisk: 'app_userevent'</span><br><span style="color: hsl(120, 100%, 40%);">+ - asterisk: 'app_originate'</span><br><span style="color: hsl(120, 100%, 40%);">+ - asterisk: 'app_read'</span><br><span style="color: hsl(120, 100%, 40%);">+ - asterisk: 'pbx_config'</span><br><span>diff --git a/tests/apps/tests.yaml b/tests/apps/tests.yaml</span><br><span>index 4f15191..5b59498 100644</span><br><span>--- a/tests/apps/tests.yaml</span><br><span>+++ b/tests/apps/tests.yaml</span><br><span>@@ -27,3 +27,4 @@</span><br><span> - test: 'waitdigit'</span><br><span> - dir: 'sendtext'</span><br><span> - test: 'mf'</span><br><span style="color: hsl(120, 100%, 40%);">+ - test: 'read'</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/testsuite/+/17728">change 17728</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/testsuite/+/17728"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: 19 </div>
<div style="display:none"> Gerrit-Change-Id: I95408f229cc7e476001019b9e47e9409283fa7f0 </div>
<div style="display:none"> Gerrit-Change-Number: 17728 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-CC: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>