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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 5 14:33:28 CDT 2011


Author: mnicholson
Date: Fri Aug  5 14:33:24 2011
New Revision: 1822

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1822
Log:
background pbx_lua test

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

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

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

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

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

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

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

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

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

Added: asterisk/trunk/tests/pbx/pbx_lua_background/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/pbx_lua_background/configs/ast1/sip.conf?view=auto&rev=1822
==============================================================================
--- asterisk/trunk/tests/pbx/pbx_lua_background/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/pbx/pbx_lua_background/configs/ast1/sip.conf Fri Aug  5 14:33:24 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_background/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

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

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

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

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

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

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

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

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

Added: asterisk/trunk/tests/pbx/pbx_lua_background/configs/ast2/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/pbx_lua_background/configs/ast2/sip.conf?view=auto&rev=1822
==============================================================================
--- asterisk/trunk/tests/pbx/pbx_lua_background/configs/ast2/sip.conf (added)
+++ asterisk/trunk/tests/pbx/pbx_lua_background/configs/ast2/sip.conf Fri Aug  5 14:33:24 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_background/configs/ast2/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: asterisk/trunk/tests/pbx/pbx_lua_background/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/pbx_lua_background/run-test?view=auto&rev=1822
==============================================================================
--- asterisk/trunk/tests/pbx/pbx_lua_background/run-test (added)
+++ asterisk/trunk/tests/pbx/pbx_lua_background/run-test Fri Aug  5 14:33:24 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_background/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

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

Added: asterisk/trunk/tests/pbx/pbx_lua_background/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/pbx_lua_background/test-config.yaml?view=auto&rev=1822
==============================================================================
--- asterisk/trunk/tests/pbx/pbx_lua_background/test-config.yaml (added)
+++ asterisk/trunk/tests/pbx/pbx_lua_background/test-config.yaml Fri Aug  5 14:33:24 2011
@@ -1,0 +1,10 @@
+testinfo:
+    summary: 'Test background support in pbx_lua.'
+    description: |
+        This test verifies the background app works properly in pbx_lua.
+
+properties:
+    minversion: '1.8'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'

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

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

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

Modified: asterisk/trunk/tests/pbx/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/tests.yaml?view=diff&rev=1822&r1=1821&r2=1822
==============================================================================
--- asterisk/trunk/tests/pbx/tests.yaml (original)
+++ asterisk/trunk/tests/pbx/tests.yaml Fri Aug  5 14:33:24 2011
@@ -2,5 +2,6 @@
 tests:
     - test: 'call-files'
     - test: 'pbx_lua_goto'
+    - test: 'pbx_lua_background'
     # Temporarily disabled while failures are debugged
     #- test: 'call-files2'




More information about the asterisk-commits mailing list