[asterisk-commits] mjordan: testsuite/asterisk/trunk r5120 - in /asterisk/trunk/tests/manager: ....

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 13 13:12:10 CDT 2014


Author: mjordan
Date: Fri Jun 13 13:12:04 2014
New Revision: 5120

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5120
Log:
manager: Add a status action and channelvars tests

This patch adds tests to cover code affected by the proposed change on review
https://reviewboard.asterisk.org/r/3568.

This patch includes tests for AMI Status and the AMI channelvars setting. This
action and that setting were affected by the patch. Both tests pass with and
without the presence of the patch.

Review: https://reviewboard.asterisk.org/r/3578/

ASTERISK-23811

Added:
    asterisk/trunk/tests/manager/manager_vars/
    asterisk/trunk/tests/manager/manager_vars/configs/
    asterisk/trunk/tests/manager/manager_vars/configs/ast1/
    asterisk/trunk/tests/manager/manager_vars/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/manager/manager_vars/configs/ast1/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/manager/manager_vars/test-config.yaml   (with props)
    asterisk/trunk/tests/manager/status/
    asterisk/trunk/tests/manager/status/configs/
    asterisk/trunk/tests/manager/status/configs/ast1/
    asterisk/trunk/tests/manager/status/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/manager/status/status.py   (with props)
    asterisk/trunk/tests/manager/status/test-config.yaml   (with props)
Modified:
    asterisk/trunk/tests/manager/tests.yaml

Added: asterisk/trunk/tests/manager/manager_vars/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/manager_vars/configs/ast1/extensions.conf?view=auto&rev=5120
==============================================================================
--- asterisk/trunk/tests/manager/manager_vars/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/manager/manager_vars/configs/ast1/extensions.conf Fri Jun 13 13:12:04 2014
@@ -1,0 +1,7 @@
+
+[default]
+
+exten => s,1,NoOp()
+ same => n,Answer()
+ same => n,Set(foo=bar)
+ same => n,Hangup()

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

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

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

Added: asterisk/trunk/tests/manager/manager_vars/configs/ast1/manager.general.conf.inc
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/manager_vars/configs/ast1/manager.general.conf.inc?view=auto&rev=5120
==============================================================================
--- asterisk/trunk/tests/manager/manager_vars/configs/ast1/manager.general.conf.inc (added)
+++ asterisk/trunk/tests/manager/manager_vars/configs/ast1/manager.general.conf.inc Fri Jun 13 13:12:04 2014
@@ -1,0 +1,1 @@
+channelvars = foo,does_not_exist

Propchange: asterisk/trunk/tests/manager/manager_vars/configs/ast1/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/manager/manager_vars/configs/ast1/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/manager/manager_vars/configs/ast1/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/manager/manager_vars/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/manager_vars/test-config.yaml?view=auto&rev=5120
==============================================================================
--- asterisk/trunk/tests/manager/manager_vars/test-config.yaml (added)
+++ asterisk/trunk/tests/manager/manager_vars/test-config.yaml Fri Jun 13 13:12:04 2014
@@ -1,0 +1,59 @@
+testinfo:
+    summary: 'Test AMI channelvars setting'
+    description: |
+        This test verifies that the channelvars setting in
+        manager is honored. All events should have the
+        specified channel variables in them. This includes
+        variables with a value (foo, set during the test)
+        and those without (does_not_exist, never set).
+
+test-modules:
+    test-object:
+        config-section: test-config
+        typename: 'test_case.SimpleTestCase'
+    modules:
+      -
+        config-section: 'ami-config'
+        typename: 'ami.AMIEventModule'
+
+test-config:
+  spawn-after-hangup: True
+  expected_events: 0
+  test-iterations:
+    -
+      channel: 'Local/s at default'
+      application: 'Echo'
+      data: ''
+
+ami-config:
+  -
+    type: 'headermatch'
+    conditions:
+      match:
+          Event: 'Newexten'
+          Exten: 's'
+          Context: 'default'
+          Priority: '3'
+    requirements:
+      match:
+          ChanVariable: 'foo='
+          ChanVariable: 'does_not_exist='
+    count: '1'
+  -
+    type: 'headermatch'
+    conditions:
+      match:
+          Event: 'VarSet'
+          Variable: 'foo'
+    requirements:
+      match:
+          Value: 'bar'
+          ChanVariable: 'foo=bar'
+          ChanVariable: 'does_not_exist='
+    count: '1'
+
+properties:
+    minversion: '12.0.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'

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

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

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

Added: asterisk/trunk/tests/manager/status/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/status/configs/ast1/extensions.conf?view=auto&rev=5120
==============================================================================
--- asterisk/trunk/tests/manager/status/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/manager/status/configs/ast1/extensions.conf Fri Jun 13 13:12:04 2014
@@ -1,0 +1,6 @@
+[default]
+
+exten => s,1,NoOp()
+ same => n,Answer()
+ same => n,Echo()
+

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

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

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

Added: asterisk/trunk/tests/manager/status/status.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/status/status.py?view=auto&rev=5120
==============================================================================
--- asterisk/trunk/tests/manager/status/status.py (added)
+++ asterisk/trunk/tests/manager/status/status.py Fri Jun 13 13:12:04 2014
@@ -1,0 +1,30 @@
+#!/usr/bin/env python
+"""Test snippet that drives the Status AMI action in the status test
+
+Copyright (C) 2014, Digium, Inc.
+Matt Jordan <mjordan at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+"""
+
+def exec_status(ami, event):
+    """Run the Status AMI action, then hangup
+
+    Keyword Arguments:
+    ami   The AMI connection
+    event The event that triggered the callback
+    """
+
+    def _hangup_channels(result, ami, channel):
+        ami.hangup(channel)
+        return result
+
+    # Get a list of channels
+    ami.status()
+
+    # Get a specific channel
+    df = ami.status(channel=event.get('channel'))
+    df.addCallback(_hangup_channels, ami, event.get('channel'))
+
+    return True

Propchange: asterisk/trunk/tests/manager/status/status.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/manager/status/status.py
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/manager/status/status.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/manager/status/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/status/test-config.yaml?view=auto&rev=5120
==============================================================================
--- asterisk/trunk/tests/manager/status/test-config.yaml (added)
+++ asterisk/trunk/tests/manager/status/test-config.yaml Fri Jun 13 13:12:04 2014
@@ -1,0 +1,125 @@
+testinfo:
+    summary: 'Test AMI Status Action'
+    description: |
+        This test verifies the AMI Status Action. A Local channel is
+        created, then two variants are executed:
+        (1) The first runs the action for all channels on the system.
+            Two events are expected, one for each of the Local channel
+            pairs.
+        (2) The second queries the ;2 channel. The same event for that
+            channel is expected.
+
+test-modules:
+    add-test-to-search-path: 'True'
+    test-object:
+        config-section: test-config
+        typename: 'test_case.SimpleTestCase'
+    modules:
+      -
+        config-section: 'ami-config'
+        typename: 'ami.AMIEventModule'
+
+test-config:
+  spawn-after-hangup: True
+  expected_events: 0
+  test-iterations:
+    -
+      channel: 'Local/s at default'
+      application: 'Echo'
+      data: ''
+
+ami-config:
+  -
+    type: 'callback'
+    conditions:
+      match:
+          Event: 'Newexten'
+          Exten: 's'
+          Context: 'default'
+          Priority: '3'
+          Channel: 'Local/s at default-00000000;2'
+    callbackModule: 'status'
+    callbackMethod: 'exec_status'
+    count: '1'
+  -
+    type: 'headermatch'
+    conditions:
+      match:
+          Event: 'Status'
+          Channel: 'Local/s at default-00000000;1'
+    requirements:
+      match:
+          Privilege: 'Call'
+          ChannelState: '6'
+          ChannelStateDesc: 'Up'
+          CallerIDNum: '<unknown>'
+          CallerIDName: '<unknown>'
+          ConnectedLineNum: '<unknown>'
+          ConnectedLineName: '<unknown>'
+          Accountcode: ''
+          Context: 'default'
+          Exten: 's'
+          Priority: '1'
+          Uniqueid: '[1-9].*'
+          Type: 'Local'
+          DNID: ''
+          EffectiveConnectedLineNum: '<unknown>'
+          EffectiveConnectedLineName: '<unknown>'
+          TimeToHangup: '0'
+          BridgeID: ''
+          Linkedid: '[1-9].*'
+          Application: 'Echo'
+          Data: ''
+          Nativeformats: '\(slin\)'
+          Readformat: 'slin'
+          Readtrans: ''
+          Writeformat: 'slin'
+          Writetrans: ''
+          Callgroup: '0'
+          Pickupgroup: '0'
+          Seconds: '[0-9]'
+    count: '1'
+  -
+    type: 'headermatch'
+    conditions:
+      match:
+          Event: 'Status'
+          Channel: 'Local/s at default-00000000;2'
+    requirements:
+      match:
+          Privilege: 'Call'
+          ChannelState: '6'
+          ChannelStateDesc: 'Up'
+          CallerIDNum: '<unknown>'
+          CallerIDName: '<unknown>'
+          ConnectedLineNum: '<unknown>'
+          ConnectedLineName: '<unknown>'
+          Accountcode: ''
+          Context: 'default'
+          Exten: 's'
+          Priority: '3'
+          Uniqueid: '[1-9].*'
+          Type: 'Local'
+          DNID: ''
+          EffectiveConnectedLineNum: '<unknown>'
+          EffectiveConnectedLineName: '<unknown>'
+          TimeToHangup: '0'
+          BridgeID: ''
+          Linkedid: '[1-9].*'
+          Application: 'Echo'
+          Data: ''
+          Nativeformats: '\(slin\)'
+          Readformat: 'slin'
+          Readtrans: ''
+          Writeformat: 'slin'
+          Writetrans: ''
+          Callgroup: '0'
+          Pickupgroup: '0'
+          Seconds: '[0-9]'
+    count: '2'
+
+properties:
+    minversion: '12.0.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'

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

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

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

Modified: asterisk/trunk/tests/manager/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/tests.yaml?view=diff&rev=5120&r1=5119&r2=5120
==============================================================================
--- asterisk/trunk/tests/manager/tests.yaml (original)
+++ asterisk/trunk/tests/manager/tests.yaml Fri Jun 13 13:12:04 2014
@@ -10,5 +10,7 @@
     - test: 'originate'
     - test: 'device_state_changed'
     - test: 'presence_state_changed'
+    - test: 'manager_vars'
+    - test: 'status'
     # Temporarily disabled while failures are debugged
     #- test: 'response-time'




More information about the asterisk-commits mailing list