[svn-commits] sgriepentrog: testsuite/asterisk/trunk r5064 - in /asterisk/trunk: lib/python...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue May 27 09:48:31 CDT 2014


Author: sgriepentrog
Date: Tue May 27 09:48:16 2014
New Revision: 5064

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5064
Log:
testsuite: Add tests for ARI user events

1) events/user/channel - insure that dialplan application
   Userevent() produces correct ARI and AMI events

2) events/user/multi - issue multiple versions of the ARI
   user event and look for matching ARI and AMI events

3) events/user/invalid - check that the right HTTP result
   code is returned for invalid input cases

Changes to ari.py made to add checking of the status code
returned from HTTP requests in the form:

   expected: 404

ASTERISK-22697
Review: https://reviewboard.asterisk.org/r/3501/


Added:
    asterisk/trunk/tests/rest_api/events/
    asterisk/trunk/tests/rest_api/events/tests.yaml   (with props)
    asterisk/trunk/tests/rest_api/events/user/
    asterisk/trunk/tests/rest_api/events/user/channel/
    asterisk/trunk/tests/rest_api/events/user/channel/configs/
    asterisk/trunk/tests/rest_api/events/user/channel/configs/ast1/
    asterisk/trunk/tests/rest_api/events/user/channel/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/rest_api/events/user/channel/test-config.yaml   (with props)
    asterisk/trunk/tests/rest_api/events/user/invalid/
    asterisk/trunk/tests/rest_api/events/user/invalid/configs/
    asterisk/trunk/tests/rest_api/events/user/invalid/configs/ast1/
    asterisk/trunk/tests/rest_api/events/user/invalid/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/rest_api/events/user/invalid/test-config.yaml   (with props)
    asterisk/trunk/tests/rest_api/events/user/multi/
    asterisk/trunk/tests/rest_api/events/user/multi/configs/
    asterisk/trunk/tests/rest_api/events/user/multi/configs/ast1/
    asterisk/trunk/tests/rest_api/events/user/multi/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/rest_api/events/user/multi/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/rest_api/events/user/multi/test-config.yaml   (with props)
    asterisk/trunk/tests/rest_api/events/user/tests.yaml   (with props)
Modified:
    asterisk/trunk/lib/python/asterisk/ari.py
    asterisk/trunk/tests/rest_api/tests.yaml

Modified: asterisk/trunk/lib/python/asterisk/ari.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/ari.py?view=diff&rev=5064&r1=5063&r2=5064
==============================================================================
--- asterisk/trunk/lib/python/asterisk/ari.py (original)
+++ asterisk/trunk/lib/python/asterisk/ari.py Tue May 27 09:48:16 2014
@@ -488,6 +488,77 @@
         return resp
 
 
+class ARIRequest(object):
+    """ Object that issues ARI requests and valiates response """
+
+    def __init__(self, ari, config):
+        self.ari = ari
+        self.method = config['method']
+        self.uri = config['uri']
+        self.params = config.get('params') or {}
+        self.body = config.get('body')
+        self.instance = config.get('instance')
+        self.delay = config.get('delay')
+        self.expect = config.get('expect')
+        self.headers = None
+
+        if self.body:
+            self.body = json.dumps(self.body)
+            self.headers = {'Content-type': 'application/json'}
+
+    def var_replace(self, text, values):
+        """ perform variable replacement on text
+
+        This allows a string such as uri to be written in the form:
+        playbacks/{playback.id}/control
+
+        :param text: text with optional {var} entries
+        :param values: nested dict of values to get replacement values from
+        """
+        for match in re.findall(r'{[^}]*}', text):
+            value = values
+            for var in match[1:-1].split('.'):
+                if not var in value:
+                    LOGGER.error('Unable to replace variables in %s from %s' %
+                                 text, values)
+                    return None
+                value = value[var]
+            text = text.replace(match, value)
+
+        return text
+
+    def send(self, values):
+        uri = self.var_replace(self.uri, values)
+        url = self.ari.build_url(uri)
+        requests_method = getattr(requests, self.method)
+
+        response = requests_method(
+            url,
+            params=self.params,
+            data=self.body,
+            headers=self.headers,
+            auth=self.ari.userpass)
+
+        if self.expect:
+            if response.status_code != self.expect:
+                LOGGER.error('sent %s %s %s expected %s response %d %s' % (
+                    self.method, self.uri, self.params,
+                    self.expect,
+                    response.status_code, response.text))
+                return False
+        else:
+            if response.status_code / 100 != 2:
+                LOGGER.error('sent %s %s %s response %d %s' % (
+                    self.method, self.uri, self.params,
+                    response.status_code, response.text))
+                return False
+
+        LOGGER.info('sent %s %s %s response %d %s' % (
+            self.method, self.uri, self.params,
+            response.status_code, response.text))
+        return response
+
+
 class EventMatcher(object):
     """Object to observe incoming events and match them against a config"""
 
@@ -508,61 +579,13 @@
             # No callback; just use a no-op
             self.callback = lambda *args, **kwargs: True
 
-        self.requests = []
-        request_list = self.instance_config.get('requests')
-        if not request_list:
-            request_list = []
+        request_list = self.instance_config.get('requests') or []
         if isinstance(request_list, dict):
             request_list = [request_list]
-        for request in request_list:
-            params = request['params'] if 'params' in request else {}
-            inst = request['instance'] if 'instance' in request else 0
-            delay = request['delay'] if 'delay' in request else 0
-            self.requests.append({
-                'method': request['method'],
-                'uri': request['uri'],
-                'params': params,
-                'instance': inst,
-                'delay': delay
-            })
+        self.requests = [ARIRequest(ari, request_config)
+                         for request_config in request_list]
 
         test_object.register_stop_observer(self.on_stop)
-
-    def var_replace(self, uri, values):
-        """ perform variable replacement on uri
-
-        This allows a uri to be written in the form:
-        playbacks/{playback.id}/control
-
-        :param uri: uri with optional {var} entries
-        :param values: nested dict of values to get replacement values from
-        """
-        for match in re.findall(r'{[^}]*}', uri):
-            value = values
-            for var in match[1:-1].split('.'):
-                if not var in value:
-                    LOGGER.error('Unable to replace variables in %s from %s' %
-                                 uri, values)
-                    return None
-                value = value[var]
-            uri = uri.replace(match, value)
-
-        return uri
-
-    def send_request(self, request, uri):
-        """ transmit an ari request
-
-        :param request: request parameters
-        :param uri: uri rewritten for this call
-        """
-        response = self.ari.request(request['method'],
-                                    uri,
-                                    **request['params'])
-
-        LOGGER.info('%s %s %s returned %s' % (request['method'],
-                                              uri,
-                                              request['params'],
-                                              response))
 
     def on_event(self, message):
         """Callback for every received ARI event.
@@ -574,17 +597,14 @@
 
             # send any associated requests
             for request in self.requests:
-                if request['instance'] and request['instance'] != self.count:
+                if request.instance and request.instance != self.count:
                     continue
-                uri = self.var_replace(request['uri'], message)
-                if uri:
-                    if request['delay']:
-                        reactor.callLater(request['delay'],
-                                          self.send_request,
-                                          request,
-                                          uri)
-                    else:
-                        self.send_request(request, uri)
+                if request.delay:
+                    reactor.callLater(request.delay, request.send, message)
+                else:
+                    response = request.send(message)
+                if response is False:
+                    self.passed = False
 
             # Split call and accumulation to always call the callback
             try:
@@ -709,3 +729,5 @@
     else:
         # Need exactly this many events
         return Range(int(yaml), int(yaml))
+
+# vim:sw=4:ts=4:expandtab:textwidth=79

Added: asterisk/trunk/tests/rest_api/events/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/events/tests.yaml?view=auto&rev=5064
==============================================================================
--- asterisk/trunk/tests/rest_api/events/tests.yaml (added)
+++ asterisk/trunk/tests/rest_api/events/tests.yaml Tue May 27 09:48:16 2014
@@ -1,0 +1,3 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - dir:  'user'

Propchange: asterisk/trunk/tests/rest_api/events/tests.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/events/tests.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/rest_api/events/tests.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/rest_api/events/user/channel/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/events/user/channel/configs/ast1/extensions.conf?view=auto&rev=5064
==============================================================================
--- asterisk/trunk/tests/rest_api/events/user/channel/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/rest_api/events/user/channel/configs/ast1/extensions.conf Tue May 27 09:48:16 2014
@@ -1,0 +1,8 @@
+[default]
+
+exten => s,1,NoOp()
+	same => n,Answer()
+	same => n,Wait(3)
+	same => n,UserEvent(CanYouSeeMe,Param1: Value1,Param2: Value2)
+	same => n,Echo()
+	same => n,Hangup()

Propchange: asterisk/trunk/tests/rest_api/events/user/channel/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/events/user/channel/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/rest_api/events/user/channel/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/rest_api/events/user/channel/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/events/user/channel/test-config.yaml?view=auto&rev=5064
==============================================================================
--- asterisk/trunk/tests/rest_api/events/user/channel/test-config.yaml (added)
+++ asterisk/trunk/tests/rest_api/events/user/channel/test-config.yaml Tue May 27 09:48:16 2014
@@ -1,0 +1,86 @@
+testinfo:
+    summary: Test dialplan app user event from a channel not in stasis.
+    description: |
+        1) use ari to start a pair of local channels
+        2) subscribe to the second channel in dialplan
+        3) dialplan of second channel signals user event
+        4) check user event message received
+
+test-modules:
+    add-test-to-search-path: True
+    test-object:
+        typename: ari.AriOriginateTestObject
+    modules:
+        -
+            config-section: ari-config
+            typename: ari.WebSocketEventModule
+        -
+            config-section: ami-config
+            typename: ami.AMIEventModule
+
+ari-config:
+    events:
+        -   conditions:
+                match:
+                    type: StasisStart
+                    application: testsuite
+                    channel:
+                        id: 'testsuite-default-id$'
+                    args: []
+            count: 1
+            # dialplan is waiting 3 seconds for subscription
+            # before issuing event
+            requests:
+                method: 'post'
+                uri: 'applications/testsuite/subscription'
+                params:
+                    eventSource: 'channel:testsuite-default-id;2'
+                expect: 200
+        -   conditions:
+                match:
+                    type: ChannelUserevent
+                    application: testsuite
+                    eventname: CanYouSeeMe
+                    # event arguments with redundant name
+                    userevent:
+                        eventname: CanYouSeeMe
+                        Param1: Value1
+                        Param2: Value2
+                    channel:
+                        id: 'testsuite-default-id;2'
+            count: 1
+            requests:
+                method: 'delete'
+                uri: 'channels/testsuite-default-id'
+
+ami-config:
+    -
+        type: headermatch
+        conditions:
+            match:
+                Event: UserEvent
+        requirements:
+            match:
+                Channel: 'Local/s at default-00000000;2'
+                Uniqueid: 'testsuite-default-id;2'
+                UserEvent: CanYouSeeMe
+                Param1: Value1
+                Param2: Value2
+        count: 1
+
+
+
+properties:
+    minversion: '12.3.0'
+    dependencies:
+        - python : autobahn.websocket
+        - python : requests
+        - python : twisted
+        - python : starpy
+        - asterisk : res_ari_channels
+        - asterisk : app_echo
+        - asterisk : app_userevent
+    tags:
+        - ARI
+
+

Propchange: asterisk/trunk/tests/rest_api/events/user/channel/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/events/user/channel/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/rest_api/events/user/channel/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/rest_api/events/user/invalid/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/events/user/invalid/configs/ast1/extensions.conf?view=auto&rev=5064
==============================================================================
--- asterisk/trunk/tests/rest_api/events/user/invalid/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/rest_api/events/user/invalid/configs/ast1/extensions.conf Tue May 27 09:48:16 2014
@@ -1,0 +1,6 @@
+[default]
+
+exten => s,1,NoOp()
+	same => n,Answer()
+	same => n,Echo()
+	same => n,Hangup()

Propchange: asterisk/trunk/tests/rest_api/events/user/invalid/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/events/user/invalid/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/rest_api/events/user/invalid/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/rest_api/events/user/invalid/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/events/user/invalid/test-config.yaml?view=auto&rev=5064
==============================================================================
--- asterisk/trunk/tests/rest_api/events/user/invalid/test-config.yaml (added)
+++ asterisk/trunk/tests/rest_api/events/user/invalid/test-config.yaml Tue May 27 09:48:16 2014
@@ -1,0 +1,80 @@
+testinfo:
+    summary: Test sending a user event from ARI with invalid options
+    description: |
+        Tests these scenarios for correct HTTP response code
+        1) Invalid application
+        2) Invalid source object scheme
+        3) Non-existant object
+
+test-modules:
+    add-test-to-search-path: True
+    test-object:
+        typename: ari.AriOriginateTestObject
+    modules:
+        -   config-section: ari-config
+            typename: ari.WebSocketEventModule
+
+ari-config:
+    events:
+        -   conditions:
+                match:
+                    type: StasisStart
+                    application: testsuite
+                    channel:
+                        id: 'testsuite-default-id$'
+                    args: []
+            count: 1
+            requests:
+                -
+                    # test missing application (also unused variables)
+                    method: 'post'
+                    uri: 'events/user/missing-application'
+                    body:
+                        variables:
+                            Param1: Value1
+                            Param2: Value2
+                    expect: 400
+                -
+                    # test invalid application name
+                    method: 'post'
+                    uri: 'events/user/invalid-application'
+                    params:
+                        application: bogus
+                        source: 'channel:testsuite-default-id'
+                    expect: 404
+                -
+                    # test invalid source type
+                    method: 'post'
+                    uri: 'events/user/invalid-type'
+                    params:
+                        application: testsuite
+                        source: 'bogus:testsuite-default-id'
+                    expect: 400
+                -
+                    # test non-existant source id
+                    method: 'post'
+                    uri: 'events/user/bad-source'
+                    params:
+                        application: testsuite
+                        source: 'channel:doesnt-exist'
+                    expect: 422
+                -
+                    # test completed, delete channel to stop
+                    method: 'delete'
+                    uri: 'channels/testsuite-default-id'
+
+
+properties:
+    minversion: '12.3.0'
+    dependencies:
+        - python : autobahn.websocket
+        - python : requests
+        - python : twisted
+        - python : starpy
+        - asterisk : res_ari_channels
+        - asterisk : app_echo
+        - asterisk : app_userevent
+    tags:
+        - ARI
+
+

Propchange: asterisk/trunk/tests/rest_api/events/user/invalid/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/events/user/invalid/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/rest_api/events/user/invalid/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/rest_api/events/user/multi/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/events/user/multi/configs/ast1/extensions.conf?view=auto&rev=5064
==============================================================================
--- asterisk/trunk/tests/rest_api/events/user/multi/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/rest_api/events/user/multi/configs/ast1/extensions.conf Tue May 27 09:48:16 2014
@@ -1,0 +1,6 @@
+[default]
+
+exten => s,1,NoOp()
+	same => n,Answer()
+	same => n,Echo()
+	same => n,Hangup()

Propchange: asterisk/trunk/tests/rest_api/events/user/multi/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/events/user/multi/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/rest_api/events/user/multi/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/rest_api/events/user/multi/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/events/user/multi/configs/ast1/pjsip.conf?view=auto&rev=5064
==============================================================================
--- asterisk/trunk/tests/rest_api/events/user/multi/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/rest_api/events/user/multi/configs/ast1/pjsip.conf Tue May 27 09:48:16 2014
@@ -1,0 +1,19 @@
+[local]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[bob]
+type=endpoint
+context=default
+disallow=all
+allow=ulaw
+direct_media=no
+
+[alice]
+type=endpoint
+context=default
+disallow=all
+allow=ulaw
+direct_media=no
+

Propchange: asterisk/trunk/tests/rest_api/events/user/multi/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/events/user/multi/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/rest_api/events/user/multi/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/rest_api/events/user/multi/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/events/user/multi/test-config.yaml?view=auto&rev=5064
==============================================================================
--- asterisk/trunk/tests/rest_api/events/user/multi/test-config.yaml (added)
+++ asterisk/trunk/tests/rest_api/events/user/multi/test-config.yaml Tue May 27 09:48:16 2014
@@ -1,0 +1,304 @@
+testinfo:
+    summary: Test sending a user event from ARI
+    description: |
+        Test these scenarios:
+        1) User event with channel and variables
+        2) User event with channel and no variables
+        3) User event with no channel and variables
+        4) User event with no channel and no variables
+        5) User event with bridge
+        6) User event with endpoint
+        7) User event with channel and bridge
+        8...) Combinations of params in body
+
+
+test-modules:
+    add-test-to-search-path: True
+    test-object:
+        config-section: test-object-config
+        typename: ari.AriOriginateTestObject
+    modules:
+        -   config-section: ari-config
+            typename: ari.WebSocketEventModule
+        -   config-section: ami-config
+            typename: ami.AMIEventModule
+
+ari-config:
+    events:
+        -   conditions:
+                match:
+                    type: StasisStart
+                    application: testsuite
+                    channel:
+                        id: 'testsuite-default-id$'
+                    args: []
+            count: 1
+            # test 1: user event with channel and variables
+            requests:
+                method: 'post'
+                uri: 'events/user/ChannelAndData'
+                params:
+                    application: testsuite
+                    source: 'channel:testsuite-default-id'
+                body:
+                    variables:
+                        Param1: Value1
+                        Param2: Value2
+                expect: 204
+        -   conditions:
+                match:
+                    type: ChannelUserevent
+                    application: testsuite
+                    eventname: ChannelAndData
+                    userevent:
+                        eventname: ChannelAndData
+                        Param1: Value1
+                        Param2: Value2
+                    channel:
+                        id: 'testsuite-default-id$'
+            count: 1
+            # test 2: user event with channel and no variables
+            requests:
+                method: 'post'
+                uri: 'events/user/ChannelNoData'
+                params:
+                    application: testsuite
+                    source: 'channel:testsuite-default-id'
+                expect: 204
+        -   conditions:
+                match:
+                    type: ChannelUserevent
+                    application: testsuite
+                    eventname: ChannelNoData
+                    userevent:
+                        eventname: ChannelNoData
+                    channel:
+                        id: 'testsuite-default-id$'
+            count: 1
+            # test 3: user event with no channel and variables
+            requests:
+                method: 'post'
+                uri: 'events/user/DataWithNoChannel'
+                params:
+                    application: testsuite
+                body:
+                    variables:
+                        Param1: Value1
+                        Param2: Value2
+                expect: 204
+        -   conditions:
+                match:
+                    type: ChannelUserevent
+                    application: testsuite
+                    eventname: DataWithNoChannel
+                    userevent:
+                        eventname: DataWithNoChannel
+                        Param1: Value1
+                        Param2: Value2
+            count: 1
+            # test 4: user event no channel or data
+            requests:
+                method: 'post'
+                uri: 'events/user/LonesomeEvent'
+                params:
+                    application: testsuite
+                expect: 204
+        -   conditions:
+                match:
+                    type: ChannelUserevent
+                    application: testsuite
+                    eventname: LonesomeEvent
+                    userevent:
+                        eventname: LonesomeEvent
+            count: 1
+            # test 5: user event with a bridge
+            requests:
+            -   method: 'post'
+                uri: 'bridges/GeorgeWashington'
+                expect: 200
+            -   method: 'post'
+                uri: 'events/user/EventWithBridge'
+                params:
+                    application: testsuite
+                    source: 'bridge:GeorgeWashington'
+                expect: 204
+        -   conditions:
+                match:
+                    type: ChannelUserevent
+                    application: testsuite
+                    eventname: EventWithBridge
+                    bridge:
+                        id: GeorgeWashington
+            count: 1
+            # test 6: user event with an endpoint (from pjsip.conf)
+            requests:
+                method: 'post'
+                uri: 'events/user/EventWithEndpoint'
+                params:
+                    application: testsuite
+                    source: 'endpoint:PJSIP/alice'
+                expect: 204
+        -   conditions:
+                match:
+                    type: ChannelUserevent
+                    application: testsuite
+                    eventname: EventWithEndpoint
+                    endpoint:
+                        technology: PJSIP
+                        resource: alice
+            count: 1
+            # test 7: channel and bridge
+            requests:
+                method: 'post'
+                uri: 'events/user/ChannelAndBridge'
+                params:
+                    application: testsuite
+                    source: 'channel:testsuite-default-id,bridge:GeorgeWashington'
+                expect: 204
+        -   conditions:
+                match:
+                    type: ChannelUserevent
+                    application: testsuite
+                    eventname: ChannelAndBridge
+                    channel:
+                        id: 'testsuite-default-id$'
+                    bridge:
+                        id: 'GeorgeWashington'
+            count: 1
+            # test 8...: various combinations of params in body
+            requests:
+                method: 'post'
+                uri: 'events/user/BothInBody'
+                params:
+                body:
+                    application: testsuite
+                    source: 'channel:testsuite-default-id'
+                    variables:
+                        Param1: Value1
+                        Param2: Value2
+                expect: 204
+        -   conditions:
+                match:
+                    type: ChannelUserevent
+                    application: testsuite
+                    eventname: BothInBody
+                    userevent:
+                        eventname: BothInBody
+                        Param1: Value1
+                        Param2: Value2
+                    channel:
+                        id: 'testsuite-default-id$'
+            count: 1
+            requests:
+                method: 'post'
+                uri: 'events/user/AppInBody'
+                params:
+                    source: 'channel:testsuite-default-id'
+                body:
+                    application: testsuite
+                    variables:
+                        Param1: Value1
+                        Param2: Value2
+                expect: 204
+        -   conditions:
+                match:
+                    type: ChannelUserevent
+                    application: testsuite
+                    eventname: AppInBody
+                    userevent:
+                        eventname: AppInBody
+                        Param1: Value1
+                        Param2: Value2
+                    channel:
+                        id: 'testsuite-default-id$'
+            count: 1
+            requests:
+                method: 'post'
+                uri: 'events/user/SourceInBody'
+                params:
+                    application: testsuite
+                body:
+                    source: 'channel:testsuite-default-id'
+                    variables:
+                        Param1: Value1
+                        Param2: Value2
+                expect: 204
+        -   conditions:
+                match:
+                    type: ChannelUserevent
+                    application: testsuite
+                    eventname: SourceInBody
+                    userevent:
+                        eventname: SourceInBody
+                        Param1: Value1
+                        Param2: Value2
+                    channel:
+                        id: 'testsuite-default-id$'
+            count: 1
+            # end of test, delete the test channel
+            requests:
+                method: 'delete'
+                uri: 'channels/testsuite-default-id'
+
+
+
+
+ami-config:
+    -
+        type: headermatch
+        conditions:
+            match:
+                Event: UserEvent
+                UserEvent: 'ChannelAndData'
+        requirements:
+            match:
+                Channel: 'Local/s at default-00000000;1'
+                Uniqueid: 'testsuite-default-id$'
+                Param1: 'Value1'
+                Param2: 'Value2'
+        count: 1
+    -
+        type: headermatch
+        conditions:
+            match:
+                Event: UserEvent
+                UserEvent: 'ChannelNoData'
+        requirements:
+            match:
+                Channel: 'Local/s at default-00000000;1'
+                Uniqueid: 'testsuite-default-id$'
+        count: 1
+    -
+        type: headermatch
+        conditions:
+            match:
+                Event: UserEvent
+                UserEvent: 'DataWithNoChannel'
+        requirements:
+            match:
+                Param1: 'Value1'
+                Param2: 'Value2'
+        count: 0
+    -
+        type: headermatch
+        conditions:
+            match:
+                Event: UserEvent
+                UserEvent: 'LonesomeEvent'
+        count: 0
+
+
+properties:
+    minversion: '12.3.0'
+    dependencies:
+        - python : autobahn.websocket
+        - python : requests
+        - python : twisted
+        - python : starpy
+        - asterisk : res_ari_channels
+        - asterisk : app_echo
+        - asterisk : app_userevent
+    tags:
+        - ARI
+
+

Propchange: asterisk/trunk/tests/rest_api/events/user/multi/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/events/user/multi/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/rest_api/events/user/multi/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/rest_api/events/user/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/events/user/tests.yaml?view=auto&rev=5064
==============================================================================
--- asterisk/trunk/tests/rest_api/events/user/tests.yaml (added)
+++ asterisk/trunk/tests/rest_api/events/user/tests.yaml Tue May 27 09:48:16 2014
@@ -1,0 +1,5 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'channel'
+    - test: 'multi'
+    - test: 'invalid'

Propchange: asterisk/trunk/tests/rest_api/events/user/tests.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/events/user/tests.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/rest_api/events/user/tests.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/rest_api/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/tests.yaml?view=diff&rev=5064&r1=5063&r2=5064
==============================================================================
--- asterisk/trunk/tests/rest_api/tests.yaml (original)
+++ asterisk/trunk/tests/rest_api/tests.yaml Tue May 27 09:48:16 2014
@@ -13,3 +13,4 @@
     - test: 'content-type'
     - dir:  'mailbox'
     - test: 'chunked-transfer'
+    - dir:  'events'




More information about the svn-commits mailing list