[asterisk-commits] mmichelson: testsuite/asterisk/trunk r5170 - in /asterisk/trunk/tests/funcs: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 25 15:54:20 CDT 2014


Author: mmichelson
Date: Wed Jun 25 15:54:13 2014
New Revision: 5170

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5170
Log:
Add tests for the PUSH() and UNSHIFT() functions.

These tests ensure that inheritable channel variables can be
used and that the values are inherited as expected.

AFS-62 #close
Review: https://reviewboard.asterisk.org/r/3619


Added:
    asterisk/trunk/tests/funcs/func_push/
    asterisk/trunk/tests/funcs/func_push/configs/
    asterisk/trunk/tests/funcs/func_push/configs/ast1/
    asterisk/trunk/tests/funcs/func_push/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/funcs/func_push/test-config.yaml   (with props)
Modified:
    asterisk/trunk/tests/funcs/tests.yaml

Added: asterisk/trunk/tests/funcs/func_push/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/funcs/func_push/configs/ast1/extensions.conf?view=auto&rev=5170
==============================================================================
--- asterisk/trunk/tests/funcs/func_push/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/funcs/func_push/configs/ast1/extensions.conf Wed Jun 25 15:54:13 2014
@@ -1,0 +1,38 @@
+[default]
+
+exten => s,1,Answer()
+   same => n,Set(__TESTVAR=poop)
+   same => n,Set(PUSH(REGULAR_PUSH)=yes)
+   same => n,Set(PUSH(REGULAR_PUSH)=please)
+   same => n,Set(PUSH(__INHERIT_PUSH)=yes)
+   same => n,Set(PUSH(__INHERIT_PUSH)=please)
+   same => n,Set(UNSHIFT(REGULAR_UNSHIFT)=please)
+   same => n,Set(UNSHIFT(REGULAR_UNSHIFT)=yes)
+   same => n,Set(UNSHIFT(__INHERIT_UNSHIFT)=please)
+   same => n,Set(UNSHIFT(__INHERIT_UNSHIFT)=yes)
+   same => n,Dial(Local/dest at default)
+
+exten => dest,1,Answer()
+      same => n,UserEvent(PushInheritance,result: ${IF($[${INHERIT_PUSH} = yes,please]?pass:fail)})
+      same => n,UserEvent(UnshiftInheritance,result: ${IF($[${INHERIT_UNSHIFT} = yes,please]?pass:fail)})
+      same => n,Wait(1)
+	  same => n,Hangup()
+[default]
+
+exten => s,1,Answer()
+   same => n,Set(__TESTVAR=poop)
+   same => n,Set(PUSH(REGULAR_PUSH)=yes)
+   same => n,Set(PUSH(REGULAR_PUSH)=please)
+   same => n,Set(PUSH(__INHERIT_PUSH)=yes)
+   same => n,Set(PUSH(__INHERIT_PUSH)=please)
+   same => n,Set(UNSHIFT(REGULAR_UNSHIFT)=please)
+   same => n,Set(UNSHIFT(REGULAR_UNSHIFT)=yes)
+   same => n,Set(UNSHIFT(__INHERIT_UNSHIFT)=please)
+   same => n,Set(UNSHIFT(__INHERIT_UNSHIFT)=yes)
+   same => n,Dial(Local/dest at default)
+
+exten => dest,1,Answer()
+      same => n,UserEvent(PushInheritance,result: ${IF($[${INHERIT_PUSH} = yes,please]?pass:fail)})
+      same => n,UserEvent(UnshiftInheritance,result: ${IF($[${INHERIT_UNSHIFT} = yes,please]?pass:fail)})
+      same => n,Wait(1)
+	  same => n,Hangup()

Propchange: asterisk/trunk/tests/funcs/func_push/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/funcs/func_push/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/funcs/func_push/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/funcs/func_push/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/funcs/func_push/test-config.yaml?view=auto&rev=5170
==============================================================================
--- asterisk/trunk/tests/funcs/func_push/test-config.yaml (added)
+++ asterisk/trunk/tests/funcs/func_push/test-config.yaml Wed Jun 25 15:54:13 2014
@@ -1,0 +1,236 @@
+testinfo:
+    summary: 'Tests the PUSH and UNSHIFT dialplan functions, ensuring the inheritable variables are evaluated properly'
+    description: |
+        "This test ensures that the PUSH and UNSHIFT functions correctly append and
+        prepend strings to a variable. The test performs this on both regular variables
+        as well as inheritable variables. With the inheritable variables, we also
+        ensure that the variable values are inherited as expected."
+
+test-modules:
+    test-object:
+        config-section: test-case-config
+        typename: 'test_case.TestCaseModule'
+    modules:
+        -
+            config-section: originator-config
+            typename: 'pluggable_modules.Originator'
+        -
+            config-section: hangup-config
+            typename: 'pluggable_modules.HangupMonitor'
+        -
+            config-section: ami-config
+            typename: 'ami.AMIEventModule'
+
+test-case-config:
+    connect-ami: 'True'
+
+hangup-config:
+    ids: ['0']
+
+originator-config:
+    trigger: 'ami_connect'
+
+ami-config:
+    -
+        type: 'orderedheadermatch'
+        conditions:
+            match:
+                Event: 'VarSet'
+                Variable: 'REGULAR_PUSH'
+        requirements:
+            -
+                match:
+                    Value: 'yes'
+            -
+                match:
+                    Value: 'yes,please'
+        count: '2'
+    -
+        type: 'orderedheadermatch'
+        conditions:
+            match:
+                Event: 'VarSet'
+                Variable: '__INHERIT_PUSH'
+        requirements:
+            -
+                match:
+                    Value: 'yes'
+            -
+                match:
+                    Value: 'yes,please'
+        count: '2'
+    -
+        type: 'orderedheadermatch'
+        conditions:
+            match:
+                Event: 'VarSet'
+                Variable: 'REGULAR_UNSHIFT'
+        requirements:
+            -
+                match:
+                    Value: 'please'
+            -
+                match:
+                    Value: 'yes,please'
+        count: '2'
+    -
+        type: 'orderedheadermatch'
+        conditions:
+            match:
+                Event: 'VarSet'
+                Variable: '__INHERIT_UNSHIFT'
+        requirements:
+            -
+                match:
+                    Value: 'please'
+            -
+                match:
+                    Value: 'yes,please'
+        count: '2'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                UserEvent: 'PushInheritance'
+        requirements:
+            match:
+                result: 'pass'
+        count: '1'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                UserEvent: 'UnshiftInheritance'
+        requirements:
+            match:
+                result: 'pass'
+        count: '1'
+
+
+properties:
+    minversion: '1.8.29.0'
+    minvserion: '11.11.0'
+    minversion: '12.4.0'
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - asterisk: 'func_strings'
+testinfo:
+    summary: 'Tests the PUSH and UNSHIFT dialplan functions, ensuring the inheritable variables are evaluated properly'
+    description: |
+        "This test ensures that the PUSH and UNSHIFT functions correctly append and
+        prepend strings to a variable. The test performs this on both regular variables
+        as well as inheritable variables. With the inheritable variables, we also
+        ensure that the variable values are inherited as expected."
+
+test-modules:
+    test-object:
+        config-section: test-case-config
+        typename: 'test_case.TestCaseModule'
+    modules:
+        -
+            config-section: originator-config
+            typename: 'pluggable_modules.Originator'
+        -
+            config-section: hangup-config
+            typename: 'pluggable_modules.HangupMonitor'
+        -
+            config-section: ami-config
+            typename: 'ami.AMIEventModule'
+
+test-case-config:
+    connect-ami: 'True'
+
+hangup-config:
+    ids: ['0']
+
+originator-config:
+    trigger: 'ami_connect'
+
+ami-config:
+    -
+        type: 'orderedheadermatch'
+        conditions:
+            match:
+                Event: 'VarSet'
+                Variable: 'REGULAR_PUSH'
+        requirements:
+            -
+                match:
+                    Value: 'yes'
+            -
+                match:
+                    Value: 'yes,please'
+        count: '2'
+    -
+        type: 'orderedheadermatch'
+        conditions:
+            match:
+                Event: 'VarSet'
+                Variable: '__INHERIT_PUSH'
+        requirements:
+            -
+                match:
+                    Value: 'yes'
+            -
+                match:
+                    Value: 'yes,please'
+        count: '2'
+    -
+        type: 'orderedheadermatch'
+        conditions:
+            match:
+                Event: 'VarSet'
+                Variable: 'REGULAR_UNSHIFT'
+        requirements:
+            -
+                match:
+                    Value: 'please'
+            -
+                match:
+                    Value: 'yes,please'
+        count: '2'
+    -
+        type: 'orderedheadermatch'
+        conditions:
+            match:
+                Event: 'VarSet'
+                Variable: '__INHERIT_UNSHIFT'
+        requirements:
+            -
+                match:
+                    Value: 'please'
+            -
+                match:
+                    Value: 'yes,please'
+        count: '2'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                UserEvent: 'PushInheritance'
+        requirements:
+            match:
+                result: 'pass'
+        count: '1'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                UserEvent: 'UnshiftInheritance'
+        requirements:
+            match:
+                result: 'pass'
+        count: '1'
+
+
+properties:
+    minversion: '1.8.29.0'
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - asterisk: 'func_strings'

Propchange: asterisk/trunk/tests/funcs/func_push/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/funcs/func_push/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/funcs/func_push/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/funcs/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/funcs/tests.yaml?view=diff&rev=5170&r1=5169&r2=5170
==============================================================================
--- asterisk/trunk/tests/funcs/tests.yaml (original)
+++ asterisk/trunk/tests/funcs/tests.yaml Wed Jun 25 15:54:13 2014
@@ -5,3 +5,4 @@
     - test: 'func_presencestate'
     - test: 'func_global'
     - test: 'func_talkdetect'
+    - test: 'func_push'




More information about the asterisk-commits mailing list