[svn-commits] rmudgett: branch rmudgett/parking r2110 - /asterisk/team/rmudgett/parking/tes...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Sep 8 20:54:09 CDT 2011


Author: rmudgett
Date: Thu Sep  8 20:54:06 2011
New Revision: 2110

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=2110
Log:
Convert to use logger instead of print

Modified:
    asterisk/team/rmudgett/parking/tests/callparking/run-test

Modified: asterisk/team/rmudgett/parking/tests/callparking/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/rmudgett/parking/tests/callparking/run-test?view=diff&rev=2110&r1=2109&r2=2110
==============================================================================
--- asterisk/team/rmudgett/parking/tests/callparking/run-test (original)
+++ asterisk/team/rmudgett/parking/tests/callparking/run-test Thu Sep  8 20:54:06 2011
@@ -8,10 +8,13 @@
 '''
 
 import sys
+import logging
 from twisted.internet import reactor
 
 sys.path.append("lib/python")
 from asterisk.TestCase import TestCase
+
+logger = logging.getLogger(__name__)
 
 
 class CallParkingTest(TestCase):
@@ -27,21 +30,21 @@
         self.create_asterisk(2)
 
     def check_result(self):
-        if self.got_AMI_UnParkedCall is TRUE and self.ast1_event is True and self.ast2_event is True:
+        if self.got_AMI_UnParkedCall is True and self.ast1_event is True and self.ast2_event is True:
             self.passed = True
             self.stop_reactor()
 
     # Initiate a call to retrieve the parked call.
     def get_parkedcall(self):
-        print "Fetching parked call"
+        logger.info("Fetching parked call")
         self.ast[1].cli_originate("IAX2/ast1/701 extension s at ast1")
 
     # Called when got UnParkedCall AMI event
     def ast1_unparkedcall(self, ami, event):
         exten = event.get("exten").lower()
-        print "Parked call retrieved from exten:%s" % (exten)
+        logger.info("Parked call retrieved from exten:" + str(exten))
         if exten != "701":
-            print "Call not retrieved from expected space"
+            logger.info("Call not retrieved from expected space")
             self.stop_reactor()
             return
 
@@ -51,9 +54,9 @@
     # Called when got ParkedCall AMI event
     def ast1_parkedcall(self, ami, event):
         exten = event.get("exten").lower()
-        print "Call parked at exten:%s" % (exten)
+        logger.info("Call parked at exten:" + str(exten))
         if exten != "701":
-            print "Call not parked in expected space"
+            logger.info("Call not parked in expected space")
             self.stop_reactor()
             return
 
@@ -62,7 +65,7 @@
     # Called when got UserEvent AMI event from Ast2
     def ast2_userevent(self, ami, event):
         status = event.get("status")
-        print "ast2_userevent status:%s" % (status)
+        logger.info("ast2_userevent status:" + str(status))
         if status != "SUCCESS":
             self.stop_reactor()
             return
@@ -73,7 +76,7 @@
     # Called when got UserEvent AMI event from Ast1
     def ast1_userevent(self, ami, event):
         status = event.get("status")
-        print "ast1_userevent status:%s" % (status)
+        logger.info("ast1_userevent status:" + str(status))
         if status != "SUCCESS":
             self.stop_reactor()
             return
@@ -96,7 +99,7 @@
         # Initiate test when both AMI connections are established.
         self.ami_count += 1
         if self.ami_count == 2:
-            print "Initiating test call"
+            logger.info("Initiating test call")
             self.ast[0].cli_originate("Local/9876 at ast2/n extension 101 at ast2")
 
     # This is called when the reactor has started running.
@@ -112,6 +115,7 @@
     reactor.run()
     test.stop_asterisk()
     if test.passed:
+        logger.info("Test passed")
         return 0
     return 1
 




More information about the svn-commits mailing list