[asterisk-commits] pabelanger: branch pabelanger/testClass r1517 - in /asterisk/team/pabelanger/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 18 16:05:58 CDT 2011


Author: pabelanger
Date: Wed May 18 16:05:54 2011
New Revision: 1517

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1517
Log:
Test now passes and fails

Added:
    asterisk/team/pabelanger/testClass/tests/regressions/M18882/configs/ast1/sip.conf   (with props)
Modified:
    asterisk/team/pabelanger/testClass/tests/regressions/M18882/run-test

Added: asterisk/team/pabelanger/testClass/tests/regressions/M18882/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/testClass/tests/regressions/M18882/configs/ast1/sip.conf?view=auto&rev=1517
==============================================================================
--- asterisk/team/pabelanger/testClass/tests/regressions/M18882/configs/ast1/sip.conf (added)
+++ asterisk/team/pabelanger/testClass/tests/regressions/M18882/configs/ast1/sip.conf Wed May 18 16:05:54 2011
@@ -1,0 +1,6 @@
+[general]
+bindaddr=127.0.0.1
+
+[0004f2040001]
+type=friend
+host=dynamic

Propchange: asterisk/team/pabelanger/testClass/tests/regressions/M18882/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/team/pabelanger/testClass/tests/regressions/M18882/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/team/pabelanger/testClass/tests/regressions/M18882/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/team/pabelanger/testClass/tests/regressions/M18882/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/testClass/tests/regressions/M18882/run-test?view=diff&rev=1517&r1=1516&r2=1517
==============================================================================
--- asterisk/team/pabelanger/testClass/tests/regressions/M18882/run-test (original)
+++ asterisk/team/pabelanger/testClass/tests/regressions/M18882/run-test Wed May 18 16:05:54 2011
@@ -8,28 +8,57 @@
 '''
 
 import sys
+import logging
 from twisted.internet import reactor
 
 sys.path.append("lib/python")
 from asterisk.asterisk import Asterisk
 from asterisk.TestCase import TestCase
 
+
 class AsteriskTest(TestCase):
     def __init__(self, argv):
         TestCase.__init__(self, argv)
         self.create_asterisk()
+        self.peer = '0004f2040001'
+        self.family = 'SIP'
+        self.key = 'Registry/0004f2040001'
+        self.value = '172.16.0.100:5300:360:0004f2040001:sip:0004f2040001 at 172.16.0.100:5300'
+        self.reload = False
 
     def ami_logoff(self, ami):
-        self.passed = True
         self.stop_reactor()
 
     def ami_connect(self, ami):
         TestCase.ami_connect(self, ami)
-        self.ami[0].logoff().addCallbacks(self.ami_logoff, self.ami_login_error)
+        self.ami[0].dbPut(self.family, self.key, self.value).addCallbacks(self.ami_dbGet)
+
+    def ami_dbGet(self, ami):
+        def onResult(result):
+            if result != self.value:
+		self.ami[0].logoff().addCallbacks(self.ami_logoff)
+            if self.reload == False:
+                self.ast[0].cli_exec('module unload chan_sip')
+                self.ast[0].cli_exec('module load chan_sip')
+                self.reload = True
+                self.ami_dbGet(ami)
+            else:
+                self.sipShowPeers()
+
+        self.ami[0].dbGet(self.family, self.key).addCallbacks(onResult)
+
+    def sipShowPeers(self):
+        def onResult(result):
+            if result['reg-contact'] == 'sip:0004f2040001 at 172.16.0.100:5300':
+                self.passed = True
+            self.ami[0].logoff().addCallbacks(self.ami_logoff)
+
+        self.ami[0].sipShowPeers(self.peer).addCallbacks(onResult)
 
     def run(self):
         TestCase.run(self)
         self.create_ami_factory()
+
 
 def main(argv=None):
     if argv is None:




More information about the asterisk-commits mailing list