[asterisk-commits] pabelanger: testsuite/asterisk/trunk r1962 - in /asterisk/trunk: ./ asttest/ ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 26 13:55:34 CDT 2011


Author: pabelanger
Date: Fri Aug 26 13:55:29 2011
New Revision: 1962

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1962
Log:
Remove OptionParser from tests

This patch removes the ability to pass command-line arguements to test. Not only
is this a sloppy way of doing things, 95% of the time is was not even required.
Because some tests used the ast_version from the argv parameter, we've added the
cli_aliases.conf file to help with CLI syntax.

Additionall, I've removed valgrid support (was not used for anything) until we
decided how to find a better solution for it.  Ideally, the testsuite will have
a .config file all tests can access for global settings.

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

Added:
    asterisk/trunk/configs/cli_aliases.conf
      - copied unchanged from r1960, asterisk/team/pabelanger/RemoveOptionParser/configs/cli_aliases.conf
Modified:
    asterisk/trunk/asttest/asttest.c
    asterisk/trunk/lib/python/asterisk/TestCase.py
    asterisk/trunk/lib/python/asterisk/asterisk.py
    asterisk/trunk/runtests.py
    asterisk/trunk/tests/apps/directory_attendant_exit/run-test
    asterisk/trunk/tests/apps/directory_context_operator_exit/run-test
    asterisk/trunk/tests/apps/directory_operator_exit/run-test
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_nominal/run-test
    asterisk/trunk/tests/blind-transfer-parkingtimeout/run-test
    asterisk/trunk/tests/callparking/run-test
    asterisk/trunk/tests/channels/SIP/message_auth/run-test
    asterisk/trunk/tests/channels/SIP/message_disabled/run-test
    asterisk/trunk/tests/channels/SIP/message_from_call/run-test
    asterisk/trunk/tests/channels/SIP/message_unauth/run-test
    asterisk/trunk/tests/channels/SIP/noload_res_srtp/run-test
    asterisk/trunk/tests/channels/SIP/noload_res_srtp_attempt_srtp/run-test
    asterisk/trunk/tests/channels/SIP/options/run-test
    asterisk/trunk/tests/channels/SIP/secure_bridge_media/run-test
    asterisk/trunk/tests/channels/SIP/sip_attended_transfer/run-test
    asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/run-test
    asterisk/trunk/tests/channels/SIP/sip_attended_transfer_v6/run-test
    asterisk/trunk/tests/channels/SIP/sip_one_legged_transfer/run-test
    asterisk/trunk/tests/channels/SIP/sip_one_legged_transfer_v6/run-test
    asterisk/trunk/tests/channels/SIP/sip_register/run-test
    asterisk/trunk/tests/channels/SIP/sip_srtp/run-test
    asterisk/trunk/tests/channels/SIP/sip_tls_call/run-test
    asterisk/trunk/tests/chanspy/chanspy_barge/run-test
    asterisk/trunk/tests/chanspy/chanspy_w_mixmonitor/run-test
    asterisk/trunk/tests/directed_pickup/run-test
    asterisk/trunk/tests/dynamic-modules/run-test
    asterisk/trunk/tests/fastagi/channel-status/run-test
    asterisk/trunk/tests/fastagi/connect/run-test
    asterisk/trunk/tests/fastagi/control-stream-file/run-test
    asterisk/trunk/tests/fastagi/database/run-test
    asterisk/trunk/tests/fastagi/execute/run-test
    asterisk/trunk/tests/fastagi/get-data/run-test
    asterisk/trunk/tests/fastagi/hangup/run-test
    asterisk/trunk/tests/fastagi/record-file/run-test
    asterisk/trunk/tests/fastagi/say-alpha/run-test
    asterisk/trunk/tests/fastagi/say-date/run-test
    asterisk/trunk/tests/fastagi/say-datetime/run-test
    asterisk/trunk/tests/fastagi/say-digits/run-test
    asterisk/trunk/tests/fastagi/say-number/run-test
    asterisk/trunk/tests/fastagi/say-phonetic/run-test
    asterisk/trunk/tests/fastagi/say-time/run-test
    asterisk/trunk/tests/fastagi/stream-file/run-test
    asterisk/trunk/tests/fastagi/wait-for-digit/run-test
    asterisk/trunk/tests/fax/gateway_g711_t38/run-test
    asterisk/trunk/tests/fax/gateway_mix1/run-test
    asterisk/trunk/tests/fax/gateway_mix2/run-test
    asterisk/trunk/tests/fax/gateway_mix3/run-test
    asterisk/trunk/tests/fax/gateway_mix4/run-test
    asterisk/trunk/tests/fax/gateway_native_t38/run-test
    asterisk/trunk/tests/fax/gateway_native_t38_ced/run-test
    asterisk/trunk/tests/fax/gateway_no_t38/run-test
    asterisk/trunk/tests/fax/gateway_t38_g711/run-test
    asterisk/trunk/tests/fax/gateway_timeout1/run-test
    asterisk/trunk/tests/fax/gateway_timeout2/run-test
    asterisk/trunk/tests/fax/gateway_timeout3/run-test
    asterisk/trunk/tests/fax/gateway_timeout4/run-test
    asterisk/trunk/tests/fax/gateway_timeout5/run-test
    asterisk/trunk/tests/feature_attended_transfer/run-test
    asterisk/trunk/tests/feature_blonde_transfer/run-test
    asterisk/trunk/tests/func_srv/run-test
    asterisk/trunk/tests/iax2/basic-call/run-test
    asterisk/trunk/tests/manager/event-monitor/run-test
    asterisk/trunk/tests/manager/login/run-test
    asterisk/trunk/tests/mixmonitor/run-test
    asterisk/trunk/tests/mixmonitor_audiohook_inherit/run-test
    asterisk/trunk/tests/one-step-parking/run-test
    asterisk/trunk/tests/pbx/call-files/run-test
    asterisk/trunk/tests/pbx/merge_contexts/run-test
    asterisk/trunk/tests/pbx/pbx_lua_background/run-test
    asterisk/trunk/tests/pbx/pbx_lua_goto/run-test
    asterisk/trunk/tests/regressions/M18882/run-test
    asterisk/trunk/tests/udptl/run-test
    asterisk/trunk/tests/udptl_v6/run-test

Modified: asterisk/trunk/asttest/asttest.c
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/asttest/asttest.c?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/asttest/asttest.c (original)
+++ asterisk/trunk/asttest/asttest.c Fri Aug 26 13:55:29 2011
@@ -55,7 +55,6 @@
 		"  -v <version>   Specify the version of asterisk we are testing against.  If\n"
 		"                 not specified, the version.h file from the specified asterisk\n"
 		"                 path will be usedi to determine the version number.\n"
-		"  -n <name>      Reserved.\n"
 		"\n"
 		, prog_name, prog_name);
 }
@@ -93,9 +92,6 @@
 			break;
 		case 'a':
 			opts->asterisk_path = optarg;
-			break;
-		case 'n':
-			/* Reserved */
 			break;
 		case 's':
 			opts->single_test_mode = optarg;

Modified: asterisk/trunk/lib/python/asterisk/TestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/TestCase.py?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/lib/python/asterisk/TestCase.py (original)
+++ asterisk/trunk/lib/python/asterisk/TestCase.py Fri Aug 26 13:55:29 2011
@@ -9,7 +9,7 @@
 
 import sys
 import logging
-from optparse import OptionParser
+import os
 from twisted.internet import reactor
 from starpy import manager, fastagi
 
@@ -24,25 +24,9 @@
     reactor_timeout = 30
     passed = False
 
-    def __init__(self, argv):
-        """
-
-        Keywork arguments:
-        argv --
-
-        """
-        # get version info
-        parser = OptionParser()
-        parser.add_option("-v", "--version", dest="ast_version",
-                help="Asterisk version string")
-        parser.add_option("-n", dest="test_name",
-                help="Test name")
-        parser.add_option("--valgrind", action="store_true",
-                dest="valgrind", default=False,
-                help="Run Asterisk under valgrind.")
-
-        (self.options, args) = parser.parse_args(argv)
-        self.options.base = self.options.test_name.lstrip("tests/")
+    def __init__(self):
+        self.test_name = os.path.dirname(sys.argv[0])
+        self.base = self.test_name.lstrip("tests/")
 
         reactor.callWhenRunning(self.run)
 
@@ -55,14 +39,13 @@
         """
         for c in range(count):
             print "Creating Asterisk instance %d ..." % (c + 1)
-            self.ast.append(Asterisk(base=self.options.base))
-            self.ast[c].valgrind = self.options.valgrind
+            self.ast.append(Asterisk(base=self.base))
             # Copy shared config files
             self.ast[c].install_configs("%s/configs" %
-                    (self.options.test_name))
+                    (self.test_name))
             # Copy test specific config files
             self.ast[c].install_configs("%s/configs/ast%d" %
-                    (self.options.test_name, c + 1))
+                    (self.test_name, c + 1))
 
     def create_ami_factory(self, count=1, username="user", secret="mysecret", port=5038):
         """

Modified: asterisk/trunk/lib/python/asterisk/asterisk.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/asterisk.py?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/lib/python/asterisk/asterisk.py (original)
+++ asterisk/trunk/lib/python/asterisk/asterisk.py Fri Aug 26 13:55:29 2011
@@ -65,7 +65,6 @@
         self.astetcdir = "/etc/asterisk"
         self.ast_binary = utils.which("asterisk") or "/usr/sbin/asterisk"
         self.host = host
-        self.valgrind = False
 
         # Find the system installed asterisk.conf
         ast_confs = [
@@ -119,8 +118,6 @@
             "-f", "-g", "-q", "-m", "-n",
             "-C", "%s" % os.path.join(self.astetcdir, "asterisk.conf")
         ]
-        if self.valgrind:
-            cmd.insert(0, "valgrind")
         try:
             self.process = subprocess.Popen(cmd)
         except OSError:

Modified: asterisk/trunk/runtests.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/runtests.py?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/runtests.py (original)
+++ asterisk/trunk/runtests.py Fri Aug 26 13:55:29 2011
@@ -157,11 +157,7 @@
         start_time = time.time()
         cmd = [
             "%s/run-test" % self.test_name,
-            "-v", str(self.ast_version),
-            "-n", str(self.test_name)
         ]
-        if self.options.valgrind:
-            cmd.append("--valgrind")
         if os.path.exists(cmd[0]) and os.access(cmd[0], os.X_OK):
             print "Running %s ..." % cmd
             try:
@@ -426,9 +422,6 @@
     parser.add_option("-t", "--test",
             dest="test",
             help="Run a single specified test instead of all tests.")
-    parser.add_option("--valgrind", action="store_true",
-            dest="valgrind", default=False,
-            help="Run Asterisk under valgrind.")
     (options, args) = parser.parse_args(argv)
 
     # Check to see if this has been executed within a sub directory of an

Modified: asterisk/trunk/tests/apps/directory_attendant_exit/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_attendant_exit/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/apps/directory_attendant_exit/run-test (original)
+++ asterisk/trunk/tests/apps/directory_attendant_exit/run-test Fri Aug 26 13:55:29 2011
@@ -22,13 +22,13 @@
 class DirectoryTest(TestCase):
    reactor_timeout = 60
 
-   def __init__(self, argv):
-      TestCase.__init__(self, argv)
+   def __init__(self):
+      TestCase.__init__(self)
       self.create_asterisk(2)
 
    def ami_connect(self, ami):
       TestCase.ami_connect(self, ami)
-         
+
       ami.registerEvent('UserEvent', self.user_event)
 
       if ami.id == 0:
@@ -64,8 +64,8 @@
       self.create_ami_factory(2)
 
 
-def main(argv = sys.argv):
-   test = DirectoryTest(argv)
+def main():
+   test = DirectoryTest()
    test.start_asterisk()
    reactor.run()
    test.stop_asterisk()

Modified: asterisk/trunk/tests/apps/directory_context_operator_exit/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_context_operator_exit/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/apps/directory_context_operator_exit/run-test (original)
+++ asterisk/trunk/tests/apps/directory_context_operator_exit/run-test Fri Aug 26 13:55:29 2011
@@ -22,13 +22,13 @@
 class DirectoryTest(TestCase):
    reactor_timeout = 60
 
-   def __init__(self, argv):
-      TestCase.__init__(self, argv)
+   def __init__(self):
+      TestCase.__init__(self)
       self.create_asterisk(2)
 
    def ami_connect(self, ami):
       TestCase.ami_connect(self, ami)
-         
+
       ami.registerEvent('UserEvent', self.user_event)
 
       if ami.id == 0:
@@ -64,8 +64,8 @@
       self.create_ami_factory(2)
 
 
-def main(argv = sys.argv):
-   test = DirectoryTest(argv)
+def main():
+   test = DirectoryTest()
    test.start_asterisk()
    reactor.run()
    test.stop_asterisk()

Modified: asterisk/trunk/tests/apps/directory_operator_exit/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_operator_exit/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/apps/directory_operator_exit/run-test (original)
+++ asterisk/trunk/tests/apps/directory_operator_exit/run-test Fri Aug 26 13:55:29 2011
@@ -22,13 +22,13 @@
 class DirectoryTest(TestCase):
    reactor_timeout = 60
 
-   def __init__(self, argv):
-      TestCase.__init__(self, argv)
+   def __init__(self):
+      TestCase.__init__(self)
       self.create_asterisk(2)
 
    def ami_connect(self, ami):
       TestCase.ami_connect(self, ami)
-         
+
       ami.registerEvent('UserEvent', self.user_event)
 
       if ami.id == 0:
@@ -64,8 +64,8 @@
       self.create_ami_factory(2)
 
 
-def main(argv = sys.argv):
-   test = DirectoryTest(argv)
+def main():
+   test = DirectoryTest()
    test.start_asterisk()
    reactor.run()
    test.stop_asterisk()

Modified: asterisk/trunk/tests/apps/voicemail/leave_voicemail_nominal/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/voicemail/leave_voicemail_nominal/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/apps/voicemail/leave_voicemail_nominal/run-test (original)
+++ asterisk/trunk/tests/apps/voicemail/leave_voicemail_nominal/run-test Fri Aug 26 13:55:29 2011
@@ -22,17 +22,17 @@
 from asterisk.TestCase import TestCase
 from asterisk.voicemail import VoiceMailMailboxManagement
 
+
 class LeaveVoicemailNominal(TestCase):
 
     """The parent directory that this test resides in
     """
     testParentDir = "tests/apps/voicemail"
 
-    def __init__(self, argv):
-        TestCase.__init__(self, argv)
+    def __init__(self):
+        TestCase.__init__(self)
 
         self.create_asterisk(2)
-
 
     def ami_connect(self, ami):
         print str(datetime.now()) + " Got AMI Connect for instance " + str(ami.id)
@@ -51,14 +51,12 @@
                 df = ami.originate("sip/ast1/" + str(extension), "sendvoicemail", str(extension), 1, None, "CallId-" + str(extension), None, None, None, {}, True )
                 df.addErrback(self.handleOriginateFailure)
 
-
     def handleOriginateFailure(self, reason):
         print str(datetime.now()) + " error sending originate:"
         print reason.getTraceback()
         self.stop_reactor()
 
         return reason
-
 
     def user_event(self, ami, event):
         if event['userevent'] != 'TestResult':
@@ -80,9 +78,8 @@
         self.create_ami_factory(2)
 
 
-def main(argv = sys.argv):
-
-    test = LeaveVoicemailNominal(argv)
+def main():
+    test = LeaveVoicemailNominal()
     voicemailManager = VoiceMailMailboxManagement(test.ast[0])
 
     test.start_asterisk()

Modified: asterisk/trunk/tests/blind-transfer-parkingtimeout/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/blind-transfer-parkingtimeout/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/blind-transfer-parkingtimeout/run-test (original)
+++ asterisk/trunk/tests/blind-transfer-parkingtimeout/run-test Fri Aug 26 13:55:29 2011
@@ -10,33 +10,24 @@
 import sys
 import os
 import math
-from optparse import OptionParser
 from twisted.application import service, internet
 from twisted.internet import reactor
 from starpy import fastagi
 
 sys.path.append("lib/python")
 from asterisk.asterisk import Asterisk
-from asterisk.version import AsteriskVersion
 
 workingdir = "blind-transfer-parkingtimeout"
 testdir = "tests/%s" % workingdir
 
 class BlindTransferTest:
-    def __init__(self, argv):
+    def __init__(self):
         self.passed = False
         self.done = False
 
         # Test timeout in seconds
         self.timeout = 60
         self.last_step = ""
-
-        # get version info
-        parser = OptionParser()
-        parser.add_option("-v", "--version", dest="ast_version",
-         help="Asterisk version string")
-        (options, args) = parser.parse_args(argv)
-        self.ast_version = AsteriskVersion(options.ast_version)
 
         # FastAGI, listen for results from dialplan
         self.agi_b = fastagi.FastAGIFactory(self.get_result_b)
@@ -114,12 +105,9 @@
         reactor.callLater(self.timeout, self.read_result)
 
 
-def main(argv=None):
-    if argv is None:
-        argv = sys.argv
-
+def main():
     # Run Blind Transfer Test
-    blind_transfer_test = BlindTransferTest(argv)
+    blind_transfer_test = BlindTransferTest()
     reactor.run()
     blind_transfer_test.stop_asterisk()
     if blind_transfer_test.passed != True:

Modified: asterisk/trunk/tests/callparking/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/callparking/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/callparking/run-test (original)
+++ asterisk/trunk/tests/callparking/run-test Fri Aug 26 13:55:29 2011
@@ -16,8 +16,8 @@
 
 
 class CallParkingTest(TestCase):
-    def __init__(self, argv):
-        TestCase.__init__(self, argv)
+    def __init__(self):
+        TestCase.__init__(self)
         self.ast1_event = False
         self.ast2_event = False
 
@@ -74,12 +74,9 @@
         self.create_ami_factory(2)
 
 
-def main(argv=None):
-    if argv is None:
-        argv = sys.argv
-
+def main():
     # Run CallParking Test
-    test = CallParkingTest(argv)
+    test = CallParkingTest()
     test.start_asterisk()
     reactor.run()
     test.stop_asterisk()

Modified: asterisk/trunk/tests/channels/SIP/message_auth/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/message_auth/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/channels/SIP/message_auth/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/message_auth/run-test Fri Aug 26 13:55:29 2011
@@ -29,10 +29,7 @@
 ]
 
 
-def main(argv=None):
-    if argv is None:
-        argv = sys.argv
-
+def main():
     test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
     return test.run()
 

Modified: asterisk/trunk/tests/channels/SIP/message_disabled/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/message_disabled/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/channels/SIP/message_disabled/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/message_disabled/run-test Fri Aug 26 13:55:29 2011
@@ -24,10 +24,7 @@
 ]
 
 
-def main(argv=None):
-    if argv is None:
-        argv = sys.argv
-
+def main():
     test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
     return test.run()
 

Modified: asterisk/trunk/tests/channels/SIP/message_from_call/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/message_from_call/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/channels/SIP/message_from_call/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/message_from_call/run-test Fri Aug 26 13:55:29 2011
@@ -29,10 +29,7 @@
 ]
 
 
-def main(argv=None):
-    if argv is None:
-        argv = sys.argv
-
+def main():
     test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
     return test.run()
 

Modified: asterisk/trunk/tests/channels/SIP/message_unauth/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/message_unauth/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/channels/SIP/message_unauth/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/message_unauth/run-test Fri Aug 26 13:55:29 2011
@@ -29,10 +29,7 @@
 ]
 
 
-def main(argv=None):
-    if argv is None:
-        argv = sys.argv
-
+def main():
     test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
     return test.run()
 

Modified: asterisk/trunk/tests/channels/SIP/noload_res_srtp/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/noload_res_srtp/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/channels/SIP/noload_res_srtp/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/noload_res_srtp/run-test Fri Aug 26 13:55:29 2011
@@ -16,8 +16,8 @@
 from asterisk.TestCase import TestCase
 
 class SIPCallTest(TestCase):
-    def __init__(self, argv):
-        TestCase.__init__(self, argv)
+    def __init__(self):
+        TestCase.__init__(self)
 
         self.connected_chan1 = False
         self.connected_chan2 = False
@@ -36,8 +36,8 @@
         TestCase.run(self)
 
         print "Initiating test call"
-        self.ast[0].cli_exec(
-            "originate SIP/2000/2000 extension 1000 at siptest1")
+        self.ast[0].cli_originate(
+            "SIP/2000/2000 extension 1000 at siptest1")
 
     # This is called by each Asterisk instance if the call gets connected.
     def fastagi_connect(self, agi):
@@ -75,10 +75,8 @@
             print "Test passed"
             self.passed = True
 
-def main(argv=None):
-    if argv is None:
-        argv = sys.argv
-    test = SIPCallTest(argv)
+def main():
+    test = SIPCallTest()
     test.start_asterisk()
     reactor.run()
     test.stop_asterisk()

Modified: asterisk/trunk/tests/channels/SIP/noload_res_srtp_attempt_srtp/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/noload_res_srtp_attempt_srtp/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/channels/SIP/noload_res_srtp_attempt_srtp/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/noload_res_srtp_attempt_srtp/run-test Fri Aug 26 13:55:29 2011
@@ -16,8 +16,8 @@
 from asterisk.TestCase import TestCase
 
 class SIPCallTest(TestCase):
-    def __init__(self, argv):
-        TestCase.__init__(self, argv)
+    def __init__(self):
+        TestCase.__init__(self)
 
         self.connected_chan1 = False
         self.connected_chan2 = False
@@ -109,10 +109,8 @@
             print "Test passed"
             self.passed = True
 
-def main(argv=None):
-    if argv is None:
-        argv = sys.argv
-    test = SIPCallTest(argv)
+def main():
+    test = SIPCallTest()
     test.start_asterisk()
     reactor.run()
     test.stop_asterisk()

Modified: asterisk/trunk/tests/channels/SIP/options/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/options/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/channels/SIP/options/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/options/run-test Fri Aug 26 13:55:29 2011
@@ -26,10 +26,7 @@
 ]
 
 
-def main(argv=None):
-    if argv is None:
-        argv = sys.argv
-
+def main():
     test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
     return test.run()
 

Modified: asterisk/trunk/tests/channels/SIP/secure_bridge_media/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/secure_bridge_media/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/channels/SIP/secure_bridge_media/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/secure_bridge_media/run-test Fri Aug 26 13:55:29 2011
@@ -16,8 +16,8 @@
 from asterisk.TestCase import TestCase
 
 class SIPCallTest(TestCase):
-    def __init__(self, argv):
-        TestCase.__init__(self, argv)
+    def __init__(self):
+        TestCase.__init__(self)
 
         self.connected_chan1 = False
         self.connected_chan2 = False
@@ -73,10 +73,8 @@
             print "Test passed"
             self.passed = True
 
-def main(argv=None):
-    if argv is None:
-        argv = sys.argv
-    test = SIPCallTest(argv)
+def main():
+    test = SIPCallTest()
     test.start_asterisk()
     reactor.run()
     test.stop_asterisk()

Modified: asterisk/trunk/tests/channels/SIP/sip_attended_transfer/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_attended_transfer/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_attended_transfer/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/sip_attended_transfer/run-test Fri Aug 26 13:55:29 2011
@@ -11,33 +11,23 @@
 import os
 import signal
 import subprocess
-from optparse import OptionParser
 from twisted.application import service, internet
 from twisted.internet import reactor, defer
 from starpy import manager
 
 sys.path.append("lib/python")
 from asterisk.asterisk import Asterisk
-from asterisk.version import AsteriskVersion
 
 workingdir = "sip_attended_transfer"
 testdir = "tests/%s" % workingdir
 
 class AttTransferTest:
-    def __init__(self, argv):
+    def __init__(self):
         self.last_step = ""
         self.passed = False
 
-        # get version info
-        parser = OptionParser()
-        parser.add_option("-v", "--version", dest="ast_version",
-                          help="Asterisk version string")
-        (options, args) = parser.parse_args(argv)
-        self.ast_version = AsteriskVersion(options.ast_version)
-
         reactor.callWhenRunning(self.run)
 
-        print self.ast_version
         self.ast1 = Asterisk(base=workingdir)
         self.ast1.install_configs("%s/configs/ast1" % (testdir))
 
@@ -151,12 +141,9 @@
         # stop and read results after timeout
         reactor.callLater(25, self.readResult)
 
-def main(argv=None):
-    if argv is None:
-        argv = sys.argv
-
+def main():
     # Run Attended Transfer Test
-    att_transfer_test = AttTransferTest(argv)
+    att_transfer_test = AttTransferTest()
     reactor.run()
     att_transfer_test.stopProcesses()
     if att_transfer_test.passed != True:

Modified: asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/run-test Fri Aug 26 13:55:29 2011
@@ -11,29 +11,20 @@
 import os
 import signal
 import subprocess
-from optparse import OptionParser
 from twisted.application import service, internet
 from twisted.internet import reactor, defer
 from starpy import manager
 
 sys.path.append("lib/python")
 from asterisk.asterisk import Asterisk
-from asterisk.version import AsteriskVersion
 
 workingdir = "sip_attended_transfer_tcp"
 testdir = "tests/%s" % workingdir
 
 class AttTransferTest:
-    def __init__(self, argv):
+    def __init__(self):
         self.last_step = ""
         self.passed = False
-
-        # get version info
-        parser = OptionParser()
-        parser.add_option("-v", "--version", dest="ast_version",
-                          help="Asterisk version string")
-        (options, args) = parser.parse_args(argv)
-        self.ast_version = AsteriskVersion(options.ast_version)
 
         reactor.callWhenRunning(self.run)
 
@@ -151,12 +142,9 @@
         # stop and read results after timeout
         reactor.callLater(25, self.readResult)
 
-def main(argv=None):
-    if argv is None:
-        argv = sys.argv
-
+def main():
     # Run Attended Transfer Test
-    att_transfer_test = AttTransferTest(argv)
+    att_transfer_test = AttTransferTest()
     reactor.run()
     att_transfer_test.stopProcesses()
     if att_transfer_test.passed != True:

Modified: asterisk/trunk/tests/channels/SIP/sip_attended_transfer_v6/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_attended_transfer_v6/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_attended_transfer_v6/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/sip_attended_transfer_v6/run-test Fri Aug 26 13:55:29 2011
@@ -12,29 +12,20 @@
 import os
 import signal
 import subprocess
-from optparse import OptionParser
 from twisted.application import service, internet
 from twisted.internet import reactor, defer
 from starpy import manager
 
 sys.path.append("lib/python")
 from asterisk.asterisk import Asterisk
-from asterisk.version import AsteriskVersion
 
 workingdir = "sip_attended_transfer_v6"
 testdir = "tests/%s" % workingdir
 
 class AttTransferTest:
-    def __init__(self, argv):
+    def __init__(self):
         self.last_step = ""
         self.passed = False
-
-        # get version info
-        parser = OptionParser()
-        parser.add_option("-v", "--version", dest="ast_version",
-                          help="Asterisk version string")
-        (options, args) = parser.parse_args(argv)
-        self.ast_version = AsteriskVersion(options.ast_version)
 
         reactor.callWhenRunning(self.run)
 
@@ -151,12 +142,9 @@
         # stop and read results after timeout
         reactor.callLater(25, self.readResult)
 
-def main(argv=None):
-    if argv is None:
-        argv = sys.argv
-
+def main():
     # Run Attended Transfer Test
-    att_transfer_test = AttTransferTest(argv)
+    att_transfer_test = AttTransferTest()
     reactor.run()
     att_transfer_test.stopProcesses()
     if att_transfer_test.passed != True:

Modified: asterisk/trunk/tests/channels/SIP/sip_one_legged_transfer/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_one_legged_transfer/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_one_legged_transfer/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/sip_one_legged_transfer/run-test Fri Aug 26 13:55:29 2011
@@ -11,29 +11,20 @@
 import os
 import signal
 import subprocess
-from optparse import OptionParser
 from twisted.application import service, internet
 from twisted.internet import reactor, defer
 from starpy import manager
 
 sys.path.append("lib/python")
 from asterisk.asterisk import Asterisk
-from asterisk.version import AsteriskVersion
 
 workingdir = "sip_one_legged_transfer"
 testdir = "tests/%s" % workingdir
 
 class AttTransferTest:
-    def __init__(self, argv):
+    def __init__(self):
         self.last_step = ""
         self.passed = False
-
-        # get version info
-        parser = OptionParser()
-        parser.add_option("-v", "--version", dest="ast_version",
-                          help="Asterisk version string")
-        (options, args) = parser.parse_args(argv)
-        self.ast_version = AsteriskVersion(options.ast_version)
 
         reactor.callWhenRunning(self.run)
 
@@ -153,12 +144,9 @@
         # stop and read results after timeout
         reactor.callLater(25, self.readResult)
 
-def main(argv=None):
-    if argv is None:
-        argv = sys.argv
-
+def main():
     # Run Attended Transfer Test
-    att_transfer_test = AttTransferTest(argv)
+    att_transfer_test = AttTransferTest()
     reactor.run()
     att_transfer_test.stopProcesses()
     if att_transfer_test.passed != True:

Modified: asterisk/trunk/tests/channels/SIP/sip_one_legged_transfer_v6/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_one_legged_transfer_v6/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_one_legged_transfer_v6/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/sip_one_legged_transfer_v6/run-test Fri Aug 26 13:55:29 2011
@@ -12,29 +12,20 @@
 import os
 import signal
 import subprocess
-from optparse import OptionParser
 from twisted.application import service, internet
 from twisted.internet import reactor, defer
 from starpy import manager
 
 sys.path.append("lib/python")
 from asterisk.asterisk import Asterisk
-from asterisk.version import AsteriskVersion
 
 workingdir = "sip_one_legged_transfer_v6"
 testdir = "tests/%s" % workingdir
 
 class AttTransferTest:
-    def __init__(self, argv):
+    def __init__(self):
         self.last_step = ""
         self.passed = False
-
-        # get version info
-        parser = OptionParser()
-        parser.add_option("-v", "--version", dest="ast_version",
-                          help="Asterisk version string")
-        (options, args) = parser.parse_args(argv)
-        self.ast_version = AsteriskVersion(options.ast_version)
 
         reactor.callWhenRunning(self.run)
 
@@ -154,12 +145,9 @@
         # stop and read results after timeout
         reactor.callLater(25, self.readResult)
 
-def main(argv=None):
-    if argv is None:
-        argv = sys.argv
-
+def main():
     # Run Attended Transfer Test
-    att_transfer_test = AttTransferTest(argv)
+    att_transfer_test = AttTransferTest()
     reactor.run()
     att_transfer_test.stopProcesses()
     if att_transfer_test.passed != True:

Modified: asterisk/trunk/tests/channels/SIP/sip_register/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_register/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_register/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/sip_register/run-test Fri Aug 26 13:55:29 2011
@@ -11,30 +11,21 @@
 import os
 import signal
 import subprocess
-from optparse import OptionParser
 from twisted.application import service, internet
 from twisted.internet import reactor, defer
 from starpy import manager
 
 sys.path.append("lib/python")
 from asterisk.asterisk import Asterisk
-from asterisk.version import AsteriskVersion
 
 workingdir = "sip_register"
 testdir = "tests/%s" % workingdir
 
 class RegisterTest:
-    def __init__(self, argv):
+    def __init__(self):
         self.passed = False
         self.last_step = ""
         self.sipps = {}
-
-        #get version info
-        parser = OptionParser()
-        parser.add_option("-v", "--version", dest="ast_version",
-                          help="Asterisk version string")
-        (options, args) = parser.parse_args(argv)
-        self.ast_version = AsteriskVersion(options.ast_version)
 
         reactor.callWhenRunning(self.run)
 
@@ -102,12 +93,9 @@
         self.ami_login()
         reactor.callLater(30, self.stop_reactor)
 
-def main(argv=None):
-    if argv is None:
-        argv = sys.argv
-
+def main():
     # Run Register Test
-    test = RegisterTest(argv)
+    test = RegisterTest()
     test.start_asterisk()
     reactor.run()
     test.stop_asterisk()

Modified: asterisk/trunk/tests/channels/SIP/sip_srtp/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_srtp/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_srtp/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/sip_srtp/run-test Fri Aug 26 13:55:29 2011
@@ -16,8 +16,8 @@
 from asterisk.TestCase import TestCase
 
 class SIPCallTest(TestCase):
-    def __init__(self, argv):
-        TestCase.__init__(self, argv)
+    def __init__(self):
+        TestCase.__init__(self)
 
         self.connected_chan1 = False
         self.connected_chan2 = False
@@ -75,10 +75,8 @@
             print "Test passed"
             self.passed = True
 
-def main(argv=None):
-    if argv is None:
-        argv = sys.argv
-    test = SIPCallTest(argv)
+def main():
+    test = SIPCallTest()
     test.start_asterisk()
     reactor.run()
     test.stop_asterisk()

Modified: asterisk/trunk/tests/channels/SIP/sip_tls_call/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_tls_call/run-test?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_tls_call/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/sip_tls_call/run-test Fri Aug 26 13:55:29 2011
@@ -14,7 +14,7 @@
 from asterisk.cdr import AsteriskCSVCDR, AsteriskCSVCDRLine
 from starpy import manager
 
-#Quick little function for doing search and replace in a file used below.
+# Quick little function for doing search and replace in a file used below.
 def file_replace_string(file, search, replace):
     for line in fileinput.input(file, inplace=1):
         if search in line:
@@ -28,9 +28,9 @@
 """
 class SIPTLSCallTest(TestCase):
 
-    #Preps test objects and configuration additions as well as copies TLS keys to test folder.
-    def __init__(self, argv):
-        TestCase.__init__(self, argv)
+    # Preps test objects and configuration additions as well as copies TLS keys to test folder.
+    def __init__(self):
+        TestCase.__init__(self)
 
         print "Creating Asterisk instances ..."
         self.create_asterisk(2)
@@ -38,12 +38,12 @@
         workingdir = "channels/SIP/sip_tls_call"
         testdir = "tests/%s" % workingdir
 
-        #initialize test variables
+        # initialize test variables
         self.passed = False
         self.tone1 = False
         self.tone2 = False
 
-        #Additional setup for config files and keys
+        # Additional setup for config files and keys
         print "Building test resources ..."
         shutil.copy('%s/configs/helper1' % (testdir), '%s/configs/ast1/sip_helper.inc' % (testdir))
         shutil.copy('%s/configs/helper2' % (testdir), '%s/configs/ast2/sip_helper.inc' % (testdir))
@@ -55,25 +55,23 @@
         if os.path.exists('%s/keys' % (workingdir)):
             shutil.rmtree('%s/keys' % (workingdir))
         shutil.copytree('%s/configs/keys' % (testdir), '%s/keys' % (workingdir))
-        #End of additional setup for config files and keys
+        # End of additional setup for config files and keys
 
-
-
-    #Once the AMI Factory connects to the AMI, this function fires.
+    # Once the AMI Factory connects to the AMI, this function fires.
     def ami_connect(self, ami):
         TestCase.ami_connect(self, ami)
 
         print "AMI %d - connected, registering DTMF event..." % (ami.id + 1)
 
-        #This will make the manager listen for DTMF and callback ami_test when it sees some.
+        # This will make the manager listen for DTMF and callback ami_test when it sees some.
         ami.registerEvent('DTMF', self.ami_test)
 

[... 2436 lines stripped ...]



More information about the asterisk-commits mailing list