[asterisk-commits] pabelanger: branch pabelanger/default_settings r1038 - in /asterisk/team/pabe...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Dec 1 19:18:51 CST 2010
Author: pabelanger
Date: Wed Dec 1 19:18:46 2010
New Revision: 1038
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1038
Log:
Final tests
Modified:
asterisk/team/pabelanger/default_settings/tests/fastagi/say-date/run-test
asterisk/team/pabelanger/default_settings/tests/fastagi/say-datetime/run-test
asterisk/team/pabelanger/default_settings/tests/fastagi/say-digits/run-test
asterisk/team/pabelanger/default_settings/tests/fastagi/say-number/run-test
asterisk/team/pabelanger/default_settings/tests/fastagi/say-phonetic/run-test
asterisk/team/pabelanger/default_settings/tests/fastagi/say-time/run-test
asterisk/team/pabelanger/default_settings/tests/fastagi/stream-file/run-test
asterisk/team/pabelanger/default_settings/tests/fastagi/tests.yaml
asterisk/team/pabelanger/default_settings/tests/fastagi/wait-for-digit/run-test
Modified: asterisk/team/pabelanger/default_settings/tests/fastagi/say-date/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/say-date/run-test?view=diff&rev=1038&r1=1037&r2=1038
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/say-date/run-test (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/say-date/run-test Wed Dec 1 19:18:46 2010
@@ -20,12 +20,13 @@
workingdir = "/tmp/asterisk-testsuite/fastagi/say-date"
testdir = "tests/fastagi"
+
class FastAGISayDateTest:
def __init__(self, argv):
self.passed = False
self.notified = False
self.test = "COMPLETE"
- self.timeout = 45
+ self.timeout = 30
parser = OptionParser()
parser.add_option("-v", "--version", dest="ast_version",
@@ -48,9 +49,6 @@
def listen_result(self, agi):
print "Got test success confirmation from dialplan."
self.notified = True
- agi.finish()
- self.agi.finish()
- self.result_changed()
def on_failure(self, reason):
print 'SAY DATE failed: ', reason.getTraceback()
@@ -59,6 +57,7 @@
def finish_test(self, result):
print "AGI command reports success."
self.passed = True
+ self.result_changed()
# This gets invoked by the dialplan when the call is answered
# send SAY DATE command and wait for results
@@ -66,31 +65,23 @@
self.agi = agi
print "Connection established."
return agi.sayDate("1210498014").addCallback(
- self.finish_test
- ).addErrback(self.on_failure)
+ self.finish_test).addErrback(self.on_failure)
- # Read test results and dialplan globals
def read_result(self):
self.agi.finish()
+ self.stop_reactor()
+
if self.passed is True and self.notified is True:
- print "PASS - FastAGI SAY DATE works as expected."
+ print "Success"
else:
- self.ast1.cli_exec("core show channels")
- self.ast1.cli_exec("core show globals")
+ print "Failed"
- print "FAIL - FastAGI SAY DATE test failed. View result",\
- "of 'core show globals' in log for more detailed",\
- "failure results."
-
- self.stop_asterisk()
-
+ def stop_reactor(self):
+ print "Stopping Reactor ..."
if reactor.running:
- print "Stopping Reactor ..."
reactor.stop()
def launch_test(self):
- self.ast1.cli_exec("agi set debug on")
-
print "Originating call to begin test."
self.ast1.cli_exec("originate Local/511 at agitest extension 1 at td_and_agi_notify")
@@ -105,20 +96,22 @@
# Read result before timeout
def result_changed(self):
if self.passed is True:
- reactor.callLater(2, self.read_result)
+ self.read_result()
def run(self):
- self.start_asterisk()
- reactor.callLater(2, self.launch_test)
- reactor.callLater(self.timeout, self.read_result)
+ self.launch_test()
+ reactor.callLater(self.timeout, self.stop_reactor)
+
def main(argv=None):
if argv is None:
argv = sys.argv
- agi_test = FastAGISayDateTest(argv)
+ test = FastAGISayDateTest(argv)
+ test.start_asterisk()
reactor.run()
- if agi_test.passed is not True or agi_test.notified is not True:
+ test.stop_asterisk()
+ if test.passed is not True or test.notified is not True:
return 1
return 0
Modified: asterisk/team/pabelanger/default_settings/tests/fastagi/say-datetime/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/say-datetime/run-test?view=diff&rev=1038&r1=1037&r2=1038
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/say-datetime/run-test (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/say-datetime/run-test Wed Dec 1 19:18:46 2010
@@ -24,7 +24,7 @@
def __init__(self, argv):
self.passed = False
self.notified = False
- self.timeout = 45
+ self.timeout = 30
parser = OptionParser()
parser.add_option("-v", "--version", dest="ast_version",
@@ -47,9 +47,6 @@
def listen_result(self, agi):
print "Got test success confirmation from dialplan."
self.notified = True
- agi.finish()
- self.agi.finish()
- self.result_changed()
def on_failure(self, reason):
print 'SAY DATETIME failed: ', reason.getTraceback()
@@ -58,6 +55,7 @@
def finish_test(self, result):
print "AGI command reports success."
self.passed = True
+ self.result_changed()
# This gets invoked by the dialplan when the call is answered
# send SAY DATETIME command and wait for results
@@ -65,31 +63,22 @@
self.agi = agi
print "Connection established."
return agi.sayDateTime("1210498014").addCallback(
- self.finish_test
- ).addErrback(self.on_failure)
+ self.finish_test).addErrback(self.on_failure)
- # Read test results and dialplan globals
def read_result(self):
self.agi.finish()
+ self.stop_reactor()
if self.passed is True and self.notified is True:
- print "PASS - FastAGI SAY DATETIME works as expected."
+ print "Success"
else:
- self.ast1.cli_exec("core show channels")
- self.ast1.cli_exec("core show globals")
+ print "Failure"
- print "FAIL - FastAGI SAY DATETIME test failed. View result",\
- "of 'core show globals' in log for more detailed",\
- "failure results."
-
- self.stop_asterisk()
-
+ def stop_reactor(self):
+ print "Stopping Reactor ..."
if reactor.running:
- print "Stopping Reactor ..."
reactor.stop()
def launch_test(self):
- self.ast1.cli_exec("agi set debug on")
-
print "Originating call to begin test."
self.ast1.cli_exec("originate Local/512 at agitest extension 1 at td_and_agi_notify")
@@ -104,20 +93,22 @@
# Read result before timeout
def result_changed(self):
if self.passed is True:
- reactor.callLater(2, self.read_result)
+ self.read_result()
def run(self):
- self.start_asterisk()
- reactor.callLater(2, self.launch_test)
- reactor.callLater(self.timeout, self.read_result)
+ self.launch_test()
+ reactor.callLater(self.timeout, self.stop_reactor)
+
def main(argv=None):
if argv is None:
argv = sys.argv
- agi_test = FastAGISayDateTimeTest(argv)
+ test = FastAGISayDateTimeTest(argv)
+ test.start_asterisk()
reactor.run()
- if agi_test.passed is not True or agi_test.notified is not True:
+ test.stop_asterisk()
+ if test.passed is not True or test.notified is not True:
return 1
return 0
Modified: asterisk/team/pabelanger/default_settings/tests/fastagi/say-digits/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/say-digits/run-test?view=diff&rev=1038&r1=1037&r2=1038
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/say-digits/run-test (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/say-digits/run-test Wed Dec 1 19:18:46 2010
@@ -20,11 +20,12 @@
workingdir = "/tmp/asterisk-testsuite/fastagi/say-digits"
testdir = "tests/fastagi"
+
class FastAGISayDigitsTest:
def __init__(self, argv):
self.passed = False
self.notified = False
- self.timeout = 45
+ self.timeout = 30
parser = OptionParser()
parser.add_option("-v", "--version", dest="ast_version",
@@ -47,9 +48,6 @@
def listen_result(self, agi):
print "Got test success confirmation from dialplan."
self.notified = True
- agi.finish()
- self.agi.finish()
- self.result_changed()
def on_failure(self, reason):
print 'SAY DIGITS failed: ', reason.getTraceback()
@@ -58,6 +56,7 @@
def finish_test(self, result):
print "AGI command reports success."
self.passed = True
+ self.result_changed()
# This gets invoked by the dialplan when the call is answered
# send SAY DIGITS command and wait for results
@@ -65,31 +64,22 @@
self.agi = agi
print "Connection established."
return agi.sayDigits("31337").addCallback(
- self.finish_test
- ).addErrback(self.on_failure)
+ self.finish_test).addErrback(self.on_failure)
- # Read test results and dialplan globals
def read_result(self):
self.agi.finish()
+ self.stop_reactor()
if self.passed is True and self.notified is True:
- print "PASS - FastAGI SAY DIGITS works as expected."
+ print "Success"
else:
- self.ast1.cli_exec("core show channels")
- self.ast1.cli_exec("core show globals")
+ print "Failed"
- print "FAIL - FastAGI SAY DIGITS test failed. View result",\
- "of 'core show globals' in log for more detailed",\
- "failure results."
-
- self.stop_asterisk()
-
+ def stop_reactor(self):
+ print "Stopping Reactor ..."
if reactor.running:
- print "Stopping Reactor ..."
reactor.stop()
def launch_test(self):
- self.ast1.cli_exec("agi set debug on")
-
print "Originating call to begin test."
self.ast1.cli_exec("originate Local/514 at agitest extension 1 at td_and_agi_notify")
@@ -104,20 +94,21 @@
# Read result before timeout
def result_changed(self):
if self.passed is True:
- reactor.callLater(2, self.read_result)
+ self.read_result()
def run(self):
- self.start_asterisk()
- reactor.callLater(2, self.launch_test)
- reactor.callLater(self.timeout, self.read_result)
+ self.launch_test()
+ reactor.callLater(self.timeout, self.stop_reactor)
def main(argv=None):
if argv is None:
argv = sys.argv
- agi_test = FastAGISayDigitsTest(argv)
+ test = FastAGISayDigitsTest(argv)
+ test.start_asterisk()
reactor.run()
- if agi_test.passed is not True or agi_test.notified is not True:
+ test.stop_asterisk()
+ if test.passed is not True or test.notified is not True:
return 1
return 0
Modified: asterisk/team/pabelanger/default_settings/tests/fastagi/say-number/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/say-number/run-test?view=diff&rev=1038&r1=1037&r2=1038
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/say-number/run-test (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/say-number/run-test Wed Dec 1 19:18:46 2010
@@ -20,11 +20,12 @@
workingdir = "/tmp/asterisk-testsuite/fastagi/say-number"
testdir = "tests/fastagi"
+
class FastAGISayNumberTest:
def __init__(self, argv):
self.passed = False
self.notified = False
- self.timeout = 45
+ self.timeout = 30
parser = OptionParser()
parser.add_option("-v", "--version", dest="ast_version",
@@ -47,9 +48,6 @@
def listen_result(self, agi):
print "Got test success confirmation from dialplan."
self.notified = True
- agi.finish()
- self.agi.finish()
- self.result_changed()
def on_failure(self, reason):
print 'SAY NUMBER failed: ', reason.getTraceback()
@@ -58,6 +56,7 @@
def finish_test(self, result):
print "AGI command reports success."
self.passed = True
+ self.result_changed()
# This gets invoked by the dialplan when the call is answered
# send SAY NUMBER command and wait for results
@@ -65,31 +64,23 @@
self.agi = agi
print "Connection established."
return agi.sayNumber(2345.67).addCallback(
- self.finish_test
- ).addErrback(self.on_failure)
+ self.finish_test).addErrback(self.on_failure)
# Read test results and dialplan globals
def read_result(self):
self.agi.finish()
+ self.stop_reactor()
if self.passed is True and self.notified is True:
- print "PASS - FastAGI SAY NUMBER works as expected."
+ print "Success"
else:
- self.ast1.cli_exec("core show channels")
- self.ast1.cli_exec("core show globals")
+ print "Failed"
- print "FAIL - FastAGI SAY NUMBER test failed. View result",\
- "of 'core show globals' in log for more detailed",\
- "failure results."
-
- self.stop_asterisk()
-
+ def stop_reactor(self):
+ print "Stopping Reactor ..."
if reactor.running:
- print "Stopping Reactor ..."
reactor.stop()
def launch_test(self):
- self.ast1.cli_exec("agi set debug on")
-
print "Originating call to begin test."
self.ast1.cli_exec("originate Local/515 at agitest extension 1 at td_and_agi_notify")
@@ -104,20 +95,22 @@
# Read result before timeout
def result_changed(self):
if self.passed is True:
- reactor.callLater(2, self.read_result)
+ self.read_result()
def run(self):
- self.start_asterisk()
- reactor.callLater(2, self.launch_test)
- reactor.callLater(self.timeout, self.read_result)
+ self.launch_test()
+ reactor.callLater(self.timeout, self.stop_reactor)
+
def main(argv=None):
if argv is None:
argv = sys.argv
- agi_test = FastAGISayNumberTest(argv)
+ test = FastAGISayNumberTest(argv)
+ test.start_asterisk()
reactor.run()
- if agi_test.passed is not True or agi_test.notified is not True:
+ test.stop_asterisk()
+ if test.passed is not True or test.notified is not True:
return 1
return 0
Modified: asterisk/team/pabelanger/default_settings/tests/fastagi/say-phonetic/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/say-phonetic/run-test?view=diff&rev=1038&r1=1037&r2=1038
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/say-phonetic/run-test (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/say-phonetic/run-test Wed Dec 1 19:18:46 2010
@@ -20,11 +20,12 @@
workingdir = "/tmp/asterisk-testsuite/fastagi/say-phonetic"
testdir = "tests/fastagi"
+
class FastAGISayPhoneticTest:
def __init__(self, argv):
self.passed = False
self.notified = False
- self.timeout = 45
+ self.timeout = 30
parser = OptionParser()
parser.add_option("-v", "--version", dest="ast_version",
@@ -47,9 +48,6 @@
def listen_result(self, agi):
print "Got test success confirmation from dialplan."
self.notified = True
- agi.finish()
- self.agi.finish()
- self.result_changed()
def on_failure(self, reason):
print 'SAY PHONETIC failed: ', reason.getTraceback()
@@ -58,6 +56,7 @@
def finish_test(self, result):
print "AGI command reports success."
self.passed = True
+ self.result_changed()
# This gets invoked by the dialplan when the call is answered
# send SAY PHONETIC command and wait for results
@@ -65,31 +64,22 @@
self.agi = agi
print "Connection established."
return agi.sayPhonetic("cat").addCallback(
- self.finish_test
- ).addErrback(self.on_failure)
+ self.finish_test).addErrback(self.on_failure)
- # Read test results and dialplan globals
def read_result(self):
self.agi.finish()
+ self.stop_reactor()
if self.passed is True and self.notified is True:
- print "PASS - FastAGI SAY PHONETIC works as expected."
+ print "Passed"
else:
- self.ast1.cli_exec("core show channels")
- self.ast1.cli_exec("core show globals")
+ print "Failed"
- print "FAIL - FastAGI SAY PHONETIC test failed. View result",\
- "of 'core show globals' in log for more detailed",\
- "failure results."
-
- self.stop_asterisk()
-
+ def stop_reactor(self):
+ print "Stopping Reactor ..."
if reactor.running:
- print "Stopping Reactor ..."
reactor.stop()
def launch_test(self):
- self.ast1.cli_exec("agi set debug on")
-
print "Originating call to begin test."
self.ast1.cli_exec("originate Local/516 at agitest extension 1 at td_and_agi_notify")
@@ -104,20 +94,22 @@
# Read result before timeout
def result_changed(self):
if self.passed is True:
- reactor.callLater(2, self.read_result)
+ self.read_result()
def run(self):
- self.start_asterisk()
- reactor.callLater(2, self.launch_test)
- reactor.callLater(self.timeout, self.read_result)
+ self.launch_test()
+ reactor.callLater(self.timeout, self.stop_reactor)
+
def main(argv=None):
if argv is None:
argv = sys.argv
- agi_test = FastAGISayPhoneticTest(argv)
+ test = FastAGISayPhoneticTest(argv)
+ test.start_asterisk()
reactor.run()
- if agi_test.passed is not True or agi_test.notified is not True:
+ test.stop_asterisk()
+ if test.passed is not True or test.notified is not True:
return 1
return 0
Modified: asterisk/team/pabelanger/default_settings/tests/fastagi/say-time/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/say-time/run-test?view=diff&rev=1038&r1=1037&r2=1038
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/say-time/run-test (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/say-time/run-test Wed Dec 1 19:18:46 2010
@@ -19,6 +19,7 @@
workingdir = "/tmp/asterisk-testsuite/fastagi/say-time"
testdir = "tests/fastagi"
+
class FastAGISayTimeTest:
def __init__(self, argv):
@@ -48,9 +49,6 @@
def listen_result(self, agi):
print "Got test success confirmation from dialplan."
self.notified = True
- agi.finish()
- self.agi.finish()
- self.result_changed()
def on_failure(self, reason):
print 'SAY TIME failed: ', reason.getTraceback()
@@ -59,6 +57,7 @@
def finish_test(self, result):
print "AGI command reports success."
self.passed = True
+ self.result_changed()
# This gets invoked by the dialplan when the call is answered
# send SAY TIME command and wait for results
@@ -66,31 +65,22 @@
self.agi = agi
print "Connection established."
return agi.sayTime("1210498014").addCallback(
- self.finish_test
- ).addErrback(self.on_failure)
+ self.finish_test).addErrback(self.on_failure)
- # Read test results and dialplan globals
def read_result(self):
self.agi.finish()
+ self.stop_reactor()
if self.passed is True and self.notified is True:
- print "PASS - FastAGI SAY TIME works as expected."
+ print "Success"
else:
- self.ast1.cli_exec("core show channels")
- self.ast1.cli_exec("core show globals")
+ print "Failed"
- print "FAIL - FastAGI SAY TIME test failed. View result",\
- "of 'core show globals' in log for more detailed",\
- "failure results."
-
- self.stop_asterisk()
-
+ def stop_reactor(self):
+ print "Stopping Reactor ..."
if reactor.running:
- print "Stopping Reactor ..."
reactor.stop()
def launch_test(self):
- self.ast1.cli_exec("agi set debug on")
-
print "Originating call to begin test."
self.ast1.cli_exec("originate Local/513 at agitest extension 1 at td_and_agi_notify")
@@ -105,20 +95,22 @@
# Read result before timeout
def result_changed(self):
if self.passed is True:
- reactor.callLater(2, self.read_result)
+ self.read_result()
def run(self):
- self.start_asterisk()
- reactor.callLater(2, self.launch_test)
- reactor.callLater(self.timeout, self.read_result)
+ self.launch_test()
+ reactor.callLater(self.timeout, self.stop_reactor)
+
def main(argv=None):
if argv is None:
argv = sys.argv
- agi_test = FastAGISayTimeTest(argv)
+ test = FastAGISayTimeTest(argv)
+ test.start_asterisk()
reactor.run()
- if agi_test.passed is not True or agi_test.notified is not True:
+ test.stop_asterisk()
+ if test.passed is not True or test.notified is not True:
return 1
return 0
Modified: asterisk/team/pabelanger/default_settings/tests/fastagi/stream-file/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/stream-file/run-test?view=diff&rev=1038&r1=1037&r2=1038
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/stream-file/run-test (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/stream-file/run-test Wed Dec 1 19:18:46 2010
@@ -20,10 +20,11 @@
workingdir = "/tmp/asterisk-testsuite/fastagi/stream-file"
testdir = "tests/fastagi"
+
class FastAGIStreamFileTest:
def __init__(self, argv):
self.passed = False
- self.timeout = 45
+ self.timeout = 30
parser = OptionParser()
parser.add_option("-v", "--version", dest="ast_version",
@@ -56,30 +57,22 @@
self.agi = agi
print "Connection established."
return agi.streamFile("beep", "").addCallback(
- self.finish_test
- ).addErrback(self.on_failure)
+ self.finish_test).addErrback(self.on_failure)
- # Read test results and dialplan globals
def read_result(self):
+ self.stop_reactor()
if self.passed is True:
- print "PASS - FastAGI STREAM FILE works as expected."
+ print "Success"
else:
- self.ast1.cli_exec("core show channels")
- self.ast1.cli_exec("core show globals")
+ print "Failed"
- print "FAIL - FastAGI STREAM FILE test failed. View result of",\
- "'core show globals' in log for more detailed failure results."
-
- self.stop_asterisk()
-
+ def stop_reactor(self):
+ print "Stopping Reactor ..."
if reactor.running:
- print "Stopping Reactor ..."
reactor.stop()
def launch_test(self):
- self.ast1.cli_exec("agi set debug on")
-
print "Originating call to begin test."
self.ast1.cli_exec("originate Local/505 at agitest extension echo at agitest")
@@ -94,20 +87,22 @@
# Read result before timeout
def result_changed(self):
if self.passed is True:
- reactor.callLater(2, self.read_result)
+ self.read_result()
def run(self):
- self.start_asterisk()
- reactor.callLater(2, self.launch_test)
- reactor.callLater(self.timeout, self.read_result)
+ self.launch_test()
+ reactor.callLater(self.timeout, self.stop_reactor)
+
def main(argv=None):
if argv is None:
argv = sys.argv
- agi_test = FastAGIStreamFileTest(argv)
+ test = FastAGIStreamFileTest(argv)
+ test.start_asterisk()
reactor.run()
- if agi_test.passed is not True:
+ test.stop_asterisk()
+ if test.passed is not True:
return 1
return 0
Modified: asterisk/team/pabelanger/default_settings/tests/fastagi/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/tests.yaml?view=diff&rev=1038&r1=1037&r2=1038
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/tests.yaml (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/tests.yaml Wed Dec 1 19:18:46 2010
@@ -8,7 +8,6 @@
- test: 'database'
- test: 'execute'
- test: 'get-data'
- # Temporarily disabled while failures are debugged
- test: 'record-file'
- test: 'say-alpha'
- test: 'say-date'
Modified: asterisk/team/pabelanger/default_settings/tests/fastagi/wait-for-digit/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/wait-for-digit/run-test?view=diff&rev=1038&r1=1037&r2=1038
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/wait-for-digit/run-test (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/wait-for-digit/run-test Wed Dec 1 19:18:46 2010
@@ -20,10 +20,11 @@
workingdir = "/tmp/asterisk-testsuite/fastagi/wait-for-digit"
testdir = "tests/fastagi"
+
class FastAGIWaitForDigitTest:
def __init__(self, argv):
self.passed = False
- self.timeout = 45
+ self.timeout = 30
parser = OptionParser()
parser.add_option("-v", "--version", dest="ast_version",
@@ -60,31 +61,22 @@
self.agi = agi
print "Connection established."
return agi.waitForDigit(60, 'silence/10', '1234567890*#ABCD', 4, '#').addCallback(
- self.finish_test
- ).addErrback(self.on_failure)
+ self.finish_test).addErrback(self.on_failure)
- # Read test results and dialplan globals
def read_result(self):
+ self.stop_reactor()
if self.passed is True:
- print "PASS - FastAGI WAIT FOR DIGIT works as expected."
+ print "Success"
else:
- self.ast1.cli_exec("core show channels")
- self.ast1.cli_exec("core show globals")
+ print "Failed"
- print "FAIL - FastAGI WAIT FOR DIGIT test failed. View result",\
- "of 'core show globals' in log for more detailed",\
- "failure results."
-
- self.stop_asterisk()
-
+ def stop_reactor(self):
+ print "Stopping Reactor ..."
if reactor.running:
- print "Stopping Reactor ..."
reactor.stop()
def launch_test(self):
- self.ast1.cli_exec("agi set debug on")
-
print "Originating call to begin test."
self.ast1.cli_exec("originate Local/basic_agi at agitest extension play_dtmf at agitest")
@@ -99,20 +91,22 @@
# Read result before timeout
def result_changed(self):
if self.passed is True:
- reactor.callLater(2, self.read_result)
+ self.read_result()
def run(self):
- self.start_asterisk()
- reactor.callLater(2, self.launch_test)
- reactor.callLater(self.timeout, self.read_result)
+ self.launch_test()
+ reactor.callLater(self.timeout, self.stop_reactor)
+
def main(argv=None):
if argv is None:
argv = sys.argv
- agi_test = FastAGIWaitForDigitTest(argv)
+ test = FastAGIWaitForDigitTest(argv)
+ test.start_asterisk()
reactor.run()
- if agi_test.passed is not True:
+ test.stop_asterisk()
+ if test.passed is not True:
return 1
return 0
More information about the asterisk-commits
mailing list