[Asterisk-code-review] tests/funcs/func channel: Basic CHANNEL function tests. (testsuite[master])

Anonymous Coward asteriskteam at digium.com
Wed Mar 22 11:26:35 CDT 2017


Anonymous Coward #1000019 has submitted this change and it was merged. ( https://gerrit.asterisk.org/5280 )

Change subject: tests/funcs/func_channel: Basic CHANNEL function tests.
......................................................................


tests/funcs/func_channel: Basic CHANNEL function tests.

ASTERISK-26878

Change-Id: I680a790e3e5e634a22c915b0f9ece3a093ffe817
---
A tests/funcs/func_channel/configs/ast1/extensions.conf
A tests/funcs/func_channel/test-config.yaml
M tests/funcs/tests.yaml
3 files changed, 104 insertions(+), 4 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Mark Michelson: Looks good to me, approved
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/tests/funcs/func_channel/configs/ast1/extensions.conf b/tests/funcs/func_channel/configs/ast1/extensions.conf
new file mode 100644
index 0000000..e5504e7
--- /dev/null
+++ b/tests/funcs/func_channel/configs/ast1/extensions.conf
@@ -0,0 +1,52 @@
+[default]
+
+exten = check_match,1,NoOp()
+same = n,GotoIf($["${CHANNEL(${ARG1})}"=${ARG2}]?:fail)
+same = n,Return()
+same = n(fail),UserEvent(TestResult,Status:fail Option:${ARG1} Expected:${ARG2} Got:"${CHANNEL(${ARG1})}")
+same = n,Hangup()
+
+exten = check_regex,1,NoOp()
+same = n,GotoIf(${REGEX(${ARG2} ${CHANNEL(${ARG1})})}?:fail)
+same = n,Return()
+same = n(fail),UserEvent(TestResult,Status:fail Option:${ARG1} Expected:Regex match of ${ARG2} Got:"${CHANNEL(${ARG1})}")
+same = n,Hangup()
+
+exten = test,1,NoOp()
+same = n,Answer()
+same = n,Gosub(check_match,1(audionativeformat,"(slin)"))
+same = n,Gosub(check_match,1(audioreadformat,"slin"))
+same = n,Gosub(check_match,1(audiowriteformat,"slin"))
+
+same = n,Gosub(check_match,1(videonativeformat,"(nothing)"))
+
+same = n,Gosub(check_match,1(dtmf_features,""))
+
+same = n,Gosub(check_match,1(language,"en"))
+same = n,Gosub(check_match,1(musicclass,""))
+same = n,Gosub(check_match,1(parkinglot,""))
+
+same = n,Gosub(check_match,1(state,"Up"))
+
+same = n,Gosub(check_match,1(channeltype,"Local"))
+same = n,Gosub(check_regex,1(name,"Local/test at default-........\;2"))
+
+same = n,Gosub(check_match,1(accountcode,""))
+
+same = n,Gosub(check_match,1(checkhangup,"0"))
+
+same = n,Gosub(check_regex,1(uniqueid,"[0-9][0-9]*\.[0-9]"))
+same = n,Gosub(check_regex,1(linkedid,"[0-9][0-9]*\.[0-9]"))
+
+same = n,Gosub(check_match,1(callgroup,""))
+same = n,Gosub(check_match,1(pickupgroup,""))
+same = n,Gosub(check_match,1(namedcallgroup,""))
+same = n,Gosub(check_match,1(namedpickupgroup,""))
+
+same = n,Gosub(check_match,1(amaflags,"3"))
+same = n,Gosub(check_match,1(max_forwards,"20"))
+
+same = n,Gosub(check_regex,1(callid,"\\[C-0000000[01]\\]"))
+
+same = n,UserEvent(TestResult,Status:pass)
+same = n,Hangup()
diff --git a/tests/funcs/func_channel/test-config.yaml b/tests/funcs/func_channel/test-config.yaml
new file mode 100644
index 0000000..b08987e
--- /dev/null
+++ b/tests/funcs/func_channel/test-config.yaml
@@ -0,0 +1,47 @@
+testinfo:
+    summary:     'Tests for the CHANNEL function'
+    description: |
+        'This test exercises the general channel read options for the
+        CHANNEL function.  It is by no means exhaustive.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'test_case.SimpleTestCase'
+    modules:
+        -
+            config-section: ami-object-config
+            typename: 'ami.AMIEventModule'
+
+
+test-object-config:
+    spawn-after-hangup: True
+    ignore-originate-failures: True
+    test-iterations:
+        -
+            channel: 'Local/test at default'
+            application: 'Echo'
+
+ami-object-config:
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                UserEvent: 'TestResult'
+        requirements:
+            match:
+                Status: 'pass'
+        count: '1'
+
+
+properties:
+    minversion: [ '13.15.0', '14.4.0' ]
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - asterisk : 'app_echo'
+        - asterisk : 'app_stack'
+        - asterisk : 'app_userevent'
+        - asterisk : 'func_channel'
+        - asterisk : 'func_strings'
diff --git a/tests/funcs/tests.yaml b/tests/funcs/tests.yaml
index e538b57..ff99541 100644
--- a/tests/funcs/tests.yaml
+++ b/tests/funcs/tests.yaml
@@ -1,8 +1,9 @@
 # Enter tests here in the order they should be considered for execution:
 tests:
-    - test: 'func_jitterbuffer'
-    - test: 'func_srv'
-    - test: 'func_presencestate'
+    - test: 'func_channel'
     - test: 'func_global'
-    - test: 'func_talkdetect'
+    - test: 'func_jitterbuffer'
+    - test: 'func_presencestate'
     - test: 'func_push'
+    - test: 'func_srv'
+    - test: 'func_talkdetect'

-- 
To view, visit https://gerrit.asterisk.org/5280
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I680a790e3e5e634a22c915b0f9ece3a093ffe817
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-code-review mailing list