[asterisk-commits] dlee: branch dlee/ASTERISK-22322 r4062 - /asterisk/team/dlee/ASTERISK-22322/t...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 22 10:26:17 CDT 2013


Author: dlee
Date: Thu Aug 22 10:26:15 2013
New Revision: 4062

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4062
Log:
Fix tests/fastagi/control-stream-file. Requires starpy update

Modified:
    asterisk/team/dlee/ASTERISK-22322/tests/fastagi/control-stream-file/run-test

Modified: asterisk/team/dlee/ASTERISK-22322/tests/fastagi/control-stream-file/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ASTERISK-22322/tests/fastagi/control-stream-file/run-test?view=diff&rev=4062&r1=4061&r2=4062
==============================================================================
--- asterisk/team/dlee/ASTERISK-22322/tests/fastagi/control-stream-file/run-test (original)
+++ asterisk/team/dlee/ASTERISK-22322/tests/fastagi/control-stream-file/run-test Thu Aug 22 10:26:15 2013
@@ -7,12 +7,16 @@
 the GNU General Public License Version 2.
 '''
 
+import logging
 import sys
+
 from twisted.internet import reactor
 
 sys.path.append("lib/python")
 from asterisk.asterisk import Asterisk
 from asterisk.TestCase import TestCase
+
+LOGGER = logging.getLogger(__name__)
 
 
 class FastAGIControlStreamFileTest(TestCase):
@@ -23,30 +27,29 @@
         self.create_fastagi_factory()
 
     def on_failure(self, reason):
-        print 'Could not run CONTROL STREAM FILE: ', reason.getTraceback()
+        LOGGER.error('Could not run CONTROL STREAM FILE: ', reason.getTraceback())
         self.agi.finish()
 
     # result of 0 indicates success
     def finish_test(self, result):
-        if result is "0":
-            self.passed = True
-
-        self.result_changed()
+        LOGGER.debug("Finished.")
+        try:
+            if result[0] == 0 and result[1] is None or result[1] == -1:
+                self.passed = True
+            else:
+                LOGGER.error("Unexpected result '%r'", result)
+        finally:
+            self.stop_reactor()
 
     def fastagi_connect(self, agi):
         self.agi = agi
-        print "Connection established."
+        LOGGER.debug("Connection established.")
         return agi.controlStreamFile("beep", "").addCallback(
             self.finish_test)
 
     def launch_test(self):
-        print "Originating call to begin test."
+        LOGGER.debug("Originating call to begin test.")
         self.ast[0].cli_originate("Local/504 at agitest extension echo at agitest")
-
-    # Read result before timeout
-    def result_changed(self):
-        if self.passed is True:
-            self.stop_reactor()
 
     def run(self):
         TestCase.run(self)




More information about the asterisk-commits mailing list