[Asterisk-code-review] Change in testsuite[master]: pjsip/qualify: Add test for contacts with qualify_frequency=0

George Joseph (Code Review) asteriskteam at digium.com
Sat Apr 18 14:33:28 CDT 2015


George Joseph has uploaded a new change for review.

  https://gerrit.asterisk.org/149

Change subject: pjsip/qualify: Add test for contacts with qualify_frequency=0
......................................................................

pjsip/qualify: Add test for contacts with qualify_frequency=0

This test checks that contacts that have qualify_frequency=0
are marked as Available when they are created.

Change-Id: I7850ea087667eae7cf3645d54e7bd885cac32bf3
---
A tests/channels/pjsip/qualify/AMISendTest.py
A tests/channels/pjsip/qualify/no_qualify/configs/ast1/pjsip.conf
A tests/channels/pjsip/qualify/no_qualify/test-config.yaml
M tests/channels/pjsip/qualify/tests.yaml
4 files changed, 94 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/49/149/1

diff --git a/tests/channels/pjsip/qualify/AMISendTest.py b/tests/channels/pjsip/qualify/AMISendTest.py
new file mode 100644
index 0000000..ead830c
--- /dev/null
+++ b/tests/channels/pjsip/qualify/AMISendTest.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2013, Digium, Inc.
+Kevin Harwell <kharwell at digium.com>
+George Joseph <george.joseph at fairview5.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+
+sys.path.append("lib/python/asterisk")
+
+from test_case import TestCase
+
+class AMISendTest(TestCase):
+    def __init__(self, path=None, config=None):
+        super(AMISendTest, self).__init__(path, config)
+        self.config = config
+        self.action = config.get('ACTION')
+        if not self.action:
+            raise Exception('"ACTION" was not defined in test-config.yaml')
+        self.create_asterisk()
+
+    def run(self):
+        super(AMISendTest, self).run()
+        self.create_ami_factory()
+
+    def ami_connect(self, ami):
+        ami.sendDeferred(self.action).addCallback(self.__on_response)
+
+    def __on_response(self, result):
+        # stop test since done
+        self.stop_reactor()
+
diff --git a/tests/channels/pjsip/qualify/no_qualify/configs/ast1/pjsip.conf b/tests/channels/pjsip/qualify/no_qualify/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..28d0241
--- /dev/null
+++ b/tests/channels/pjsip/qualify/no_qualify/configs/ast1/pjsip.conf
@@ -0,0 +1,14 @@
+
+[mytransport]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[sipp]
+type=endpoint
+aors=sipp
+
+[sipp]
+type=aor
+contact=sip:127.0.0.1:5061
+qualify_frequency=0
diff --git a/tests/channels/pjsip/qualify/no_qualify/test-config.yaml b/tests/channels/pjsip/qualify/no_qualify/test-config.yaml
new file mode 100644
index 0000000..faf512b
--- /dev/null
+++ b/tests/channels/pjsip/qualify/no_qualify/test-config.yaml
@@ -0,0 +1,43 @@
+testinfo:
+    summary: 'Test contact with qualify_timeout=0'
+    description: |
+        Make sure that contacts with qualify_frequency=0 are marked
+        as Available.
+
+properties:
+    minversion: '13.4.0'
+    dependencies:
+        - asterisk : 'res_pjsip'
+
+    tags:
+        - pjsip
+
+test-modules:
+    # allow test_runner to find and run the local test
+    add-test-to-search-path: 'True'
+    add-relative-to-search-path: ['../']
+    test-object:
+        config-section: object-config
+        typename: 'AMISendTest.AMISendTest'
+    modules:
+        -
+            config-section: 'ami-config'
+            typename: 'ami.AMIEventModule'
+
+object-config:
+    reactor-timeout: 15
+    ACTION: { "Action": "PJSIPShowEndpoint", "ActionID": "12345", "Endpoint": "sipp" }
+
+ami-config:
+        -
+            type: 'headermatch'
+            conditions:
+                match:
+                    Event: 'EndpointDetail'
+            requirements:
+                match:
+                    ActionID: '12345'
+                    ObjectType: 'endpoint'
+                    ObjectName: 'sipp'
+                    DeviceState: 'Not in use'
+            count: 1
diff --git a/tests/channels/pjsip/qualify/tests.yaml b/tests/channels/pjsip/qualify/tests.yaml
index 15fa299..930aa65 100644
--- a/tests/channels/pjsip/qualify/tests.yaml
+++ b/tests/channels/pjsip/qualify/tests.yaml
@@ -4,3 +4,4 @@
     - test: 'auth'
     - test: 'max_initial_qualify_time'
     - test: 'qualify_timeout'
+    - test: 'no_qualify'

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7850ea087667eae7cf3645d54e7bd885cac32bf3
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>



More information about the asterisk-code-review mailing list