[svn-commits] mnicholson: testsuite/asterisk/trunk r1820 - in /asterisk/trunk/tests/pbx/pbx...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Aug 5 14:19:24 CDT 2011


Author: mnicholson
Date: Fri Aug  5 14:19:20 2011
New Revision: 1820

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1820
Log:
test goto in pbx_lua

Added:
    asterisk/trunk/tests/pbx/pbx_lua_goto/
    asterisk/trunk/tests/pbx/pbx_lua_goto/configs/
    asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/
    asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/
    asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/extensions.lua   (with props)
    asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/sip.conf   (with props)
    asterisk/trunk/tests/pbx/pbx_lua_goto/run-test   (with props)
    asterisk/trunk/tests/pbx/pbx_lua_goto/test-config.yaml   (with props)

Added: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/extensions.conf?view=auto&rev=1820
==============================================================================
--- asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/extensions.conf Fri Aug  5 14:19:20 2011
@@ -1,0 +1,4 @@
+[test]
+exten => 1234,1,noop
+exten => 1234,n,Wait(60)
+

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/manager.general.conf.inc
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/manager.general.conf.inc?view=auto&rev=1820
==============================================================================
--- asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/manager.general.conf.inc (added)
+++ asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/manager.general.conf.inc Fri Aug  5 14:19:20 2011
@@ -1,0 +1,2 @@
+enabled = yes
+bindaddr = 127.0.0.1

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/sip.conf?view=auto&rev=1820
==============================================================================
--- asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/sip.conf Fri Aug  5 14:19:20 2011
@@ -1,0 +1,13 @@
+[general]
+bindaddr = 127.0.0.1
+
+[ast2]
+type = friend
+fromuser = ast1
+context = test
+host = 127.0.0.2
+disallow = all
+allow = ulaw
+qualify = no
+insecure = invite
+

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/extensions.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/extensions.lua?view=auto&rev=1820
==============================================================================
--- asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/extensions.lua (added)
+++ asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/extensions.lua Fri Aug  5 14:19:20 2011
@@ -1,0 +1,17 @@
+-- vim: sw=4 et:
+
+extensions = {}
+extensions.test = {}
+
+extensions.test[1234] = function(c, e)
+    app.answer()
+    app.goto("test", "12345", 1)
+
+    -- this line should not execute because of the preceding goto
+    app.userevent("TestResult", "result: fail", "error: goto didn't actually cause a goto")
+end
+
+extensions.test[12345] = function(c, e)
+    app.userevent("TestResult", "result: pass")
+end
+

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/extensions.lua
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/extensions.lua
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/extensions.lua
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/manager.general.conf.inc
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/manager.general.conf.inc?view=auto&rev=1820
==============================================================================
--- asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/manager.general.conf.inc (added)
+++ asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/manager.general.conf.inc Fri Aug  5 14:19:20 2011
@@ -1,0 +1,2 @@
+enabled = yes
+bindaddr = 127.0.0.2

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/sip.conf?view=auto&rev=1820
==============================================================================
--- asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/sip.conf (added)
+++ asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/sip.conf Fri Aug  5 14:19:20 2011
@@ -1,0 +1,13 @@
+[general]
+bindaddr = 127.0.0.2
+
+[ast1]
+type = friend
+fromuser = ast2
+context = test
+host = 127.0.0.1
+disallow = all
+allow = ulaw
+qualify = no
+insecure = invite
+

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/pbx/pbx_lua_goto/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/pbx_lua_goto/run-test?view=auto&rev=1820
==============================================================================
--- asterisk/trunk/tests/pbx/pbx_lua_goto/run-test (added)
+++ asterisk/trunk/tests/pbx/pbx_lua_goto/run-test Fri Aug  5 14:19:20 2011
@@ -1,0 +1,80 @@
+#!/usr/bin/env python
+# vim: sw=3 et:
+'''
+Copyright (C) 2011, Digium, Inc.
+Matthew Nicholson <mnicholson at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+import os
+import re
+import shutil
+
+from twisted.internet import reactor
+
+sys.path.append("lib/python")
+from asterisk.asterisk import Asterisk
+from asterisk.TestCase import TestCase
+
+class PbxLuaTest(TestCase):
+
+   def __init__(self, argv):
+      TestCase.__init__(self, argv)
+      self.create_asterisk(2)
+
+   def ami_connect(self, ami):
+      TestCase.ami_connect(self, ami)
+
+      if ami.id == 0:
+
+         print "sending a call from ast1 to ast2"
+
+         df = ami.originate("sip/ast2/1234", "test", "1234", 1)
+
+         def handle_failure(reason):
+            print "error sending originate:"
+            print reason.getTraceback()
+            self.stop_reactor()
+
+            return reason
+
+         df.addErrback(handle_failure)
+      else:
+         ami.registerEvent('UserEvent', self.test_result)
+
+   def test_result(self, ami, event):
+      if event['userevent'] != 'TestResult':
+         return
+
+      if event['result'] == "pass":
+         print "success"
+         self.passed = True
+      else:
+         print "error:"
+         print "result: %s" % (event['result'],)
+         print "error: %s" % (event['error'],)
+
+      self.stop_reactor()
+
+   def run(self):
+      TestCase.run(self)
+      self.create_ami_factory(2)
+
+
+def main(argv = sys.argv):
+   test = PbxLuaTest(argv)
+   test.start_asterisk()
+   reactor.run()
+   test.stop_asterisk()
+
+   if not test.passed:
+      return 1
+
+   return 0
+
+if __name__ == "__main__":
+   sys.exit(main() or 0)
+

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/run-test
------------------------------------------------------------------------------
    svn:executable = *

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/run-test
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/run-test
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/pbx/pbx_lua_goto/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/pbx_lua_goto/test-config.yaml?view=auto&rev=1820
==============================================================================
--- asterisk/trunk/tests/pbx/pbx_lua_goto/test-config.yaml (added)
+++ asterisk/trunk/tests/pbx/pbx_lua_goto/test-config.yaml Fri Aug  5 14:19:20 2011
@@ -1,0 +1,10 @@
+testinfo:
+    summary: 'Test goto support in pbx_lua.'
+    description: |
+        This test verifies goto is properly detected in pbx_lua.
+
+properties:
+    minversion: '10'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/pbx/pbx_lua_goto/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the svn-commits mailing list