[asterisk-commits] russell: branch russell/messaging r297574 - in /team/russell/messaging/testsu...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Dec 3 16:04:48 CST 2010


Author: russell
Date: Fri Dec  3 16:04:44 2010
New Revision: 297574

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=297574
Log:
Convert message_auth test to the SIPpTest method

Modified:
    team/russell/messaging/testsuite-tests/message_auth/configs/ast1/extensions.conf
    team/russell/messaging/testsuite-tests/message_auth/configs/ast1/sip.conf
    team/russell/messaging/testsuite-tests/message_auth/run-test

Modified: team/russell/messaging/testsuite-tests/message_auth/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/asterisk/team/russell/messaging/testsuite-tests/message_auth/configs/ast1/extensions.conf?view=diff&rev=297574&r1=297573&r2=297574
==============================================================================
--- team/russell/messaging/testsuite-tests/message_auth/configs/ast1/extensions.conf (original)
+++ team/russell/messaging/testsuite-tests/message_auth/configs/ast1/extensions.conf Fri Dec  3 16:04:44 2010
@@ -7,4 +7,4 @@
 exten => _.,1,NoOp()
 
 exten => _sip:user at 127[.]0[.]0[.]1.,1,Verbose(1,Got a message from SIPp)
-    same => n,MessageSend(sip:user at 127.0.0.1:5062)
+    same => n,MessageSend(sip:user2)

Modified: team/russell/messaging/testsuite-tests/message_auth/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/asterisk/team/russell/messaging/testsuite-tests/message_auth/configs/ast1/sip.conf?view=diff&rev=297574&r1=297573&r2=297574
==============================================================================
--- team/russell/messaging/testsuite-tests/message_auth/configs/ast1/sip.conf (original)
+++ team/russell/messaging/testsuite-tests/message_auth/configs/ast1/sip.conf Fri Dec  3 16:04:44 2010
@@ -9,3 +9,12 @@
 port=5061
 context=not_default
 secret=blah
+
+[user2]
+type=peer
+host=127.0.0.1
+port=5062
+context=not_default
+username=user2
+secret=blah
+

Modified: team/russell/messaging/testsuite-tests/message_auth/run-test
URL: http://svnview.digium.com/svn/asterisk/team/russell/messaging/testsuite-tests/message_auth/run-test?view=diff&rev=297574&r1=297573&r2=297574
==============================================================================
--- team/russell/messaging/testsuite-tests/message_auth/run-test (original)
+++ team/russell/messaging/testsuite-tests/message_auth/run-test Fri Dec  3 16:04:44 2010
@@ -9,57 +9,33 @@
 
 import sys
 import os
-import subprocess
 
 sys.path.append("lib/python")
 sys.path.append("testsuite/lib/python")
-from asterisk.asterisk import Asterisk
+from asterisk.sipp import SIPpTest
 
 
 WORKING_DIR = "/tmp/asterisk-testsuite/sip/message_auth"
 TEST_DIR = os.path.dirname(os.path.realpath(__file__))
 
-
-def sipp(scenario, port):
-    return subprocess.Popen(['sipp', '127.0.0.1',
-                             '-sf', '%s/sipp/%s' % (TEST_DIR, scenario),
-                             '-p', port, '-m', '1', '-i', '127.0.0.1',
-                             '-timeout', '20s'],
-                            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+SIPP_SCENARIOS = [
+    {
+        'scenario' : 'message_recv.xml',
+        '-p' : '5062'
+    },
+    {
+        'scenario' : 'message.xml',
+        '-p' : '5061'
+    }
+]
 
 
 def main(argv=None):
     if argv is None:
         argv = sys.argv
 
-    ast1 = Asterisk(base=WORKING_DIR)
-    ast1.install_configs('%s/configs/ast1' % TEST_DIR)
-    ast1.start()
-
-    p1 = sipp('message_recv.xml', '5062')
-    p2 = sipp('message.xml', '5061')
-
-    (p1_stdout, p1_stderr) = p1.communicate()
-    p1_res = p1.wait()
-    (p2_stdout, p2_stderr) = p2.communicate()
-    p2_res = p2.wait()
-
-    ast1.stop()
-
-    if p1_res:
-        print "ERROR: SIPp #1 returned %s" % str(p1_res)
-        print p1_stdout
-        print p1_stderr
-
-    if p2_res:
-        print "ERROR: SIPp #2 returned %s" % str(p2_res)
-        print p2_stdout
-        print p2_stderr
-
-    if not p1_res and not p2_res:
-        print "Test Passed."
-
-    return 1 if p1_res or p2_res else 0
+    test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
+    return test.run()
 
 
 if __name__ == "__main__":




More information about the asterisk-commits mailing list