[asterisk-commits] jpeeler: branch jpeeler/event_watcher r298 - in /asterisk/team/jpeeler/event_...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 19 12:20:59 CDT 2010


Author: jpeeler
Date: Wed May 19 12:20:55 2010
New Revision: 298

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=298
Log:
moved asterisk config install out of eventwatcher to test script

Modified:
    asterisk/team/jpeeler/event_watcher/lib/python/client.py
    asterisk/team/jpeeler/event_watcher/tests/ami-monitor/run-test

Modified: asterisk/team/jpeeler/event_watcher/lib/python/client.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/jpeeler/event_watcher/lib/python/client.py?view=diff&rev=298&r1=297&r2=298
==============================================================================
--- asterisk/team/jpeeler/event_watcher/lib/python/client.py (original)
+++ asterisk/team/jpeeler/event_watcher/lib/python/client.py Wed May 19 12:20:55 2010
@@ -106,7 +106,7 @@
         self.send_event_list = list()
         self.ordered = False
 
-    def __init__(self, myargv):
+    def __init__(self, myargv, myasterisk):
         self.log = logging.getLogger('TestAMI')
         self.log.setLevel(logging.INFO)
         self.ami = None
@@ -120,6 +120,12 @@
             self.standalone = True
         else:
             self.standalone = False
+            if myasterisk == None:
+                self.passed = False
+                self.log.critical("Fail to pass Asterisk instance!")
+                return
+
+            self.asterisk = myasterisk
 
         self.reactor_lock = threading.Lock()
         self.reactor_stopped = False
@@ -128,11 +134,6 @@
 
         if self.standalone:
             return
-
-        self.log.info("Creating Asterisk instance...")
-        self.asterisk = Asterisk(base="/tmp/asterisk-testsuite/" + self.working_dir)
-        self.asterisk.install_config(self.working_dir + "/configs/manager.conf")
-        self.asterisk.install_config(self.working_dir + "/configs/logger.conf")
 
         self.start_asterisk()
 

Modified: asterisk/team/jpeeler/event_watcher/tests/ami-monitor/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/jpeeler/event_watcher/tests/ami-monitor/run-test?view=diff&rev=298&r1=297&r2=298
==============================================================================
--- asterisk/team/jpeeler/event_watcher/tests/ami-monitor/run-test (original)
+++ asterisk/team/jpeeler/event_watcher/tests/ami-monitor/run-test Wed May 19 12:20:55 2010
@@ -32,16 +32,25 @@
 
     if len(argv) == 1: # options are NOT being passed
         sys.path.append("../../lib/python")
+        asterisk = None
     else:
         sys.path.append("lib/python")
+        from asterisk.asterisk import Asterisk
+
         parser = OptionParser()
         parser.add_option("-v", "--version", dest="ast_version",
                               help="Asterisk version string")
         (options, args) = parser.parse_args(argv)
+        working_dir = os.path.dirname(argv[0])
+
+        asterisk = Asterisk(base="/tmp/asterisk-testsuite/ami-monitor")
+        asterisk.install_config("tests/configs/manager.conf")
+        asterisk.install_config("tests/configs/logger.conf")
 
     logging.basicConfig()
     import client
-    watcher = client.EventWatcher(argv)
+
+    watcher = client.EventWatcher(argv, asterisk)
     tester = Test()
 
     #watcher.log.setLevel(logging.DEBUG)




More information about the asterisk-commits mailing list