[asterisk-commits] mnicholson: testsuite/asterisk/trunk r1732 - in /asterisk/trunk/tests: ./ app...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 12 15:08:42 CDT 2011


Author: mnicholson
Date: Tue Jul 12 15:08:38 2011
New Revision: 1732

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1732
Log:
add app_directory exit tests

Added:
    asterisk/trunk/tests/apps/
    asterisk/trunk/tests/apps/directory_attendant_exit/
    asterisk/trunk/tests/apps/directory_attendant_exit/configs/
    asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast1/
    asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast1/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/
    asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/extensions.conf   (with props)
    asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/sip.conf   (with props)
    asterisk/trunk/tests/apps/directory_attendant_exit/run-test   (with props)
    asterisk/trunk/tests/apps/directory_attendant_exit/test-config.yaml   (with props)
    asterisk/trunk/tests/apps/directory_context_operator_exit/
    asterisk/trunk/tests/apps/directory_context_operator_exit/configs/
    asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast1/
    asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast1/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/
    asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/extensions.conf   (with props)
    asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/sip.conf   (with props)
    asterisk/trunk/tests/apps/directory_context_operator_exit/run-test   (with props)
    asterisk/trunk/tests/apps/directory_context_operator_exit/test-config.yaml   (with props)
    asterisk/trunk/tests/apps/directory_operator_exit/
    asterisk/trunk/tests/apps/directory_operator_exit/configs/
    asterisk/trunk/tests/apps/directory_operator_exit/configs/ast1/
    asterisk/trunk/tests/apps/directory_operator_exit/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/apps/directory_operator_exit/configs/ast1/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/apps/directory_operator_exit/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/
    asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/extensions.conf   (with props)
    asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/sip.conf   (with props)
    asterisk/trunk/tests/apps/directory_operator_exit/run-test   (with props)
    asterisk/trunk/tests/apps/directory_operator_exit/test-config.yaml   (with props)
    asterisk/trunk/tests/apps/tests.yaml   (with props)
Modified:
    asterisk/trunk/tests/tests.yaml

Added: asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast1/extensions.conf?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast1/extensions.conf Tue Jul 12 15:08:38 2011
@@ -1,0 +1,6 @@
+[senddtmf]
+exten => 1234,1,noop
+exten => 1234,n,Wait(5)
+exten => 1234,n,SendDTMF(*)
+exten => 1234,n,Wait(5)
+

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

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

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

Added: asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast1/manager.general.conf.inc
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast1/manager.general.conf.inc?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast1/manager.general.conf.inc (added)
+++ asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast1/manager.general.conf.inc Tue Jul 12 15:08:38 2011
@@ -1,0 +1,2 @@
+enabled = yes
+bindaddr = 127.0.0.1

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

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

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

Added: asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast1/sip.conf?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast1/sip.conf Tue Jul 12 15:08:38 2011
@@ -1,0 +1,12 @@
+[general]
+bindaddr = 127.0.0.1
+
+[ast2]
+type = friend
+fromuser = ast1
+host = 127.0.0.2
+disallow = all
+allow = ulaw
+qualify = no
+insecure = invite
+

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

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

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

Added: asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/extensions.conf?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/extensions.conf (added)
+++ asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/extensions.conf Tue Jul 12 15:08:38 2011
@@ -1,0 +1,7 @@
+[directory]
+exten => 1234,1,noop
+exten => 1234,n,Directory()
+exten => 1234,n,UserEvent(TestResult,result: fail,status: normal, non-dtmf assisted directory exit)
+
+exten => a,1,UserEvent(TestResult,result: pass,status: successful attendant directory exit)
+

Propchange: asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/manager.general.conf.inc
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/manager.general.conf.inc?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/manager.general.conf.inc (added)
+++ asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/manager.general.conf.inc Tue Jul 12 15:08:38 2011
@@ -1,0 +1,2 @@
+enabled = yes
+bindaddr = 127.0.0.2

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

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

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

Added: asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/sip.conf?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/sip.conf (added)
+++ asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/sip.conf Tue Jul 12 15:08:38 2011
@@ -1,0 +1,13 @@
+[general]
+bindaddr = 127.0.0.2
+
+[ast1]
+type = friend
+fromuser = ast2
+context = directory
+host = 127.0.0.1
+disallow = all
+allow = ulaw
+qualify = no
+insecure = invite
+

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

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

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

Added: asterisk/trunk/tests/apps/directory_attendant_exit/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_attendant_exit/run-test?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_attendant_exit/run-test (added)
+++ asterisk/trunk/tests/apps/directory_attendant_exit/run-test Tue Jul 12 15:08:38 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 DirectoryTest(TestCase):
+   reactor_timeout = 60
+
+   def __init__(self, argv):
+      TestCase.__init__(self, argv)
+      self.create_asterisk(2)
+
+   def ami_connect(self, ami):
+      TestCase.ami_connect(self, ami)
+         
+      ami.registerEvent('UserEvent', self.user_event)
+
+      if ami.id == 0:
+         print "sending a call from ast1 to ast2"
+
+         df = ami.originate("sip/ast2/1234", "senddtmf", "1234", 1)
+
+         def handle_failure(reason):
+            print "error sending originate:"
+            print reason.getTraceback()
+            self.stop_reactor()
+
+            return reason
+
+         df.addErrback(handle_failure)
+
+   def user_event(self, ami, event):
+      if event['userevent'] != 'TestResult':
+         return
+
+      if event['result'] == "pass":
+         self.passed = True
+         print "app_directory successfully exited"
+      else:
+         print "app_directory did not successfully exit:"
+         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 = DirectoryTest(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/apps/directory_attendant_exit/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/directory_attendant_exit/run-test
------------------------------------------------------------------------------
    svn:executable = *

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

Propchange: asterisk/trunk/tests/apps/directory_attendant_exit/run-test
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/directory_attendant_exit/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_attendant_exit/test-config.yaml?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_attendant_exit/test-config.yaml (added)
+++ asterisk/trunk/tests/apps/directory_attendant_exit/test-config.yaml Tue Jul 12 15:08:38 2011
@@ -1,0 +1,11 @@
+testinfo:
+    summary: 'Test operator exit from app_directory.'
+    description: |
+        This test verifies proper functionality of the operator exit feature of
+        app_directory.
+
+properties:
+    minversion: '1.8'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'

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

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

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

Added: asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast1/extensions.conf?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast1/extensions.conf Tue Jul 12 15:08:38 2011
@@ -1,0 +1,6 @@
+[senddtmf]
+exten => 1234,1,noop
+exten => 1234,n,Wait(5)
+exten => 1234,n,SendDTMF(0)
+exten => 1234,n,Wait(5)
+

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

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

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

Added: asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast1/manager.general.conf.inc
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast1/manager.general.conf.inc?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast1/manager.general.conf.inc (added)
+++ asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast1/manager.general.conf.inc Tue Jul 12 15:08:38 2011
@@ -1,0 +1,2 @@
+enabled = yes
+bindaddr = 127.0.0.1

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

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

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

Added: asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast1/sip.conf?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast1/sip.conf Tue Jul 12 15:08:38 2011
@@ -1,0 +1,12 @@
+[general]
+bindaddr = 127.0.0.1
+
+[ast2]
+type = friend
+fromuser = ast1
+host = 127.0.0.2
+disallow = all
+allow = ulaw
+qualify = no
+insecure = invite
+

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

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

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

Added: asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/extensions.conf?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/extensions.conf (added)
+++ asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/extensions.conf Tue Jul 12 15:08:38 2011
@@ -1,0 +1,8 @@
+[dialcontext]
+exten => o,1,UserEvent(TestResult,result: pass,status: successful operator directory exit)
+
+[directory]
+exten => 1234,1,noop
+exten => 1234,n,Directory(,dialcontext)
+exten => 1234,n,UserEvent(TestResult,result: fail,status: normal, non-dtmf assisted directory exit)
+

Propchange: asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/manager.general.conf.inc
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/manager.general.conf.inc?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/manager.general.conf.inc (added)
+++ asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/manager.general.conf.inc Tue Jul 12 15:08:38 2011
@@ -1,0 +1,2 @@
+enabled = yes
+bindaddr = 127.0.0.2

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

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

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

Added: asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/sip.conf?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/sip.conf (added)
+++ asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/sip.conf Tue Jul 12 15:08:38 2011
@@ -1,0 +1,13 @@
+[general]
+bindaddr = 127.0.0.2
+
+[ast1]
+type = friend
+fromuser = ast2
+context = directory
+host = 127.0.0.1
+disallow = all
+allow = ulaw
+qualify = no
+insecure = invite
+

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

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

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

Added: asterisk/trunk/tests/apps/directory_context_operator_exit/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_context_operator_exit/run-test?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_context_operator_exit/run-test (added)
+++ asterisk/trunk/tests/apps/directory_context_operator_exit/run-test Tue Jul 12 15:08:38 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 DirectoryTest(TestCase):
+   reactor_timeout = 60
+
+   def __init__(self, argv):
+      TestCase.__init__(self, argv)
+      self.create_asterisk(2)
+
+   def ami_connect(self, ami):
+      TestCase.ami_connect(self, ami)
+         
+      ami.registerEvent('UserEvent', self.user_event)
+
+      if ami.id == 0:
+         print "sending a call from ast1 to ast2"
+
+         df = ami.originate("sip/ast2/1234", "senddtmf", "1234", 1)
+
+         def handle_failure(reason):
+            print "error sending originate:"
+            print reason.getTraceback()
+            self.stop_reactor()
+
+            return reason
+
+         df.addErrback(handle_failure)
+
+   def user_event(self, ami, event):
+      if event['userevent'] != 'TestResult':
+         return
+
+      if event['result'] == "pass":
+         self.passed = True
+         print "app_directory successfully exited"
+      else:
+         print "app_directory did not successfully exit:"
+         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 = DirectoryTest(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/apps/directory_context_operator_exit/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/directory_context_operator_exit/run-test
------------------------------------------------------------------------------
    svn:executable = *

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

Propchange: asterisk/trunk/tests/apps/directory_context_operator_exit/run-test
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/directory_context_operator_exit/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_context_operator_exit/test-config.yaml?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_context_operator_exit/test-config.yaml (added)
+++ asterisk/trunk/tests/apps/directory_context_operator_exit/test-config.yaml Tue Jul 12 15:08:38 2011
@@ -1,0 +1,11 @@
+testinfo:
+    summary: 'Test operator exit from app_directory.'
+    description: |
+        This test verifies proper functionality of the operator exit feature of
+        app_directory.
+
+properties:
+    minversion: '1.8'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'

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

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

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

Added: asterisk/trunk/tests/apps/directory_operator_exit/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_operator_exit/configs/ast1/extensions.conf?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_operator_exit/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/apps/directory_operator_exit/configs/ast1/extensions.conf Tue Jul 12 15:08:38 2011
@@ -1,0 +1,6 @@
+[senddtmf]
+exten => 1234,1,noop
+exten => 1234,n,Wait(5)
+exten => 1234,n,SendDTMF(0)
+exten => 1234,n,Wait(5)
+

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

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

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

Added: asterisk/trunk/tests/apps/directory_operator_exit/configs/ast1/manager.general.conf.inc
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_operator_exit/configs/ast1/manager.general.conf.inc?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_operator_exit/configs/ast1/manager.general.conf.inc (added)
+++ asterisk/trunk/tests/apps/directory_operator_exit/configs/ast1/manager.general.conf.inc Tue Jul 12 15:08:38 2011
@@ -1,0 +1,2 @@
+enabled = yes
+bindaddr = 127.0.0.1

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

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

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

Added: asterisk/trunk/tests/apps/directory_operator_exit/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_operator_exit/configs/ast1/sip.conf?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_operator_exit/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/apps/directory_operator_exit/configs/ast1/sip.conf Tue Jul 12 15:08:38 2011
@@ -1,0 +1,12 @@
+[general]
+bindaddr = 127.0.0.1
+
+[ast2]
+type = friend
+fromuser = ast1
+host = 127.0.0.2
+disallow = all
+allow = ulaw
+qualify = no
+insecure = invite
+

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

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

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

Added: asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/extensions.conf?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/extensions.conf (added)
+++ asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/extensions.conf Tue Jul 12 15:08:38 2011
@@ -1,0 +1,7 @@
+[directory]
+exten => 1234,1,noop
+exten => 1234,n,Directory()
+exten => 1234,n,UserEvent(TestResult,result: fail,status: normal, non-dtmf assisted directory exit)
+
+exten => o,1,UserEvent(TestResult,result: pass,status: successful operator directory exit)
+

Propchange: asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/manager.general.conf.inc
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/manager.general.conf.inc?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/manager.general.conf.inc (added)
+++ asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/manager.general.conf.inc Tue Jul 12 15:08:38 2011
@@ -1,0 +1,2 @@
+enabled = yes
+bindaddr = 127.0.0.2

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

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

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

Added: asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/sip.conf?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/sip.conf (added)
+++ asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/sip.conf Tue Jul 12 15:08:38 2011
@@ -1,0 +1,13 @@
+[general]
+bindaddr = 127.0.0.2
+
+[ast1]
+type = friend
+fromuser = ast2
+context = directory
+host = 127.0.0.1
+disallow = all
+allow = ulaw
+qualify = no
+insecure = invite
+

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

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

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

Added: asterisk/trunk/tests/apps/directory_operator_exit/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_operator_exit/run-test?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_operator_exit/run-test (added)
+++ asterisk/trunk/tests/apps/directory_operator_exit/run-test Tue Jul 12 15:08:38 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 DirectoryTest(TestCase):
+   reactor_timeout = 60
+
+   def __init__(self, argv):
+      TestCase.__init__(self, argv)
+      self.create_asterisk(2)
+
+   def ami_connect(self, ami):
+      TestCase.ami_connect(self, ami)
+         
+      ami.registerEvent('UserEvent', self.user_event)
+
+      if ami.id == 0:
+         print "sending a call from ast1 to ast2"
+
+         df = ami.originate("sip/ast2/1234", "senddtmf", "1234", 1)
+
+         def handle_failure(reason):
+            print "error sending originate:"
+            print reason.getTraceback()
+            self.stop_reactor()
+
+            return reason
+
+         df.addErrback(handle_failure)
+
+   def user_event(self, ami, event):
+      if event['userevent'] != 'TestResult':
+         return
+
+      if event['result'] == "pass":
+         self.passed = True
+         print "app_directory successfully exited"
+      else:
+         print "app_directory did not successfully exit:"
+         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 = DirectoryTest(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/apps/directory_operator_exit/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/directory_operator_exit/run-test
------------------------------------------------------------------------------
    svn:executable = *

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

Propchange: asterisk/trunk/tests/apps/directory_operator_exit/run-test
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/directory_operator_exit/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/directory_operator_exit/test-config.yaml?view=auto&rev=1732
==============================================================================
--- asterisk/trunk/tests/apps/directory_operator_exit/test-config.yaml (added)
+++ asterisk/trunk/tests/apps/directory_operator_exit/test-config.yaml Tue Jul 12 15:08:38 2011
@@ -1,0 +1,11 @@
+testinfo:
+    summary: 'Test operator exit from app_directory.'
+    description: |
+        This test verifies proper functionality of the operator exit feature of
+        app_directory.
+
+properties:
+    minversion: '1.8'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'

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

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


[... 39 lines stripped ...]



More information about the asterisk-commits mailing list