[asterisk-commits] mjordan: testsuite/asterisk/trunk r4047 - /asterisk/trunk/lib/python/asterisk/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 19 12:36:20 CDT 2013


Author: mjordan
Date: Mon Aug 19 12:36:18 2013
New Revision: 4047

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4047
Log:
Add a very basic test object based solely on TestCase

This patch adds a very basic test object, TestCaseModule, which is used
by the bridge_action test. The test object is suitable for the pluggable
tests that need a test object that provides little to no actual functionality
other than starting up Asterisk and connecting AMI.

Modified:
    asterisk/trunk/lib/python/asterisk/TestCase.py

Modified: asterisk/trunk/lib/python/asterisk/TestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/TestCase.py?view=diff&rev=4047&r1=4046&r2=4047
==============================================================================
--- asterisk/trunk/lib/python/asterisk/TestCase.py (original)
+++ asterisk/trunk/lib/python/asterisk/TestCase.py Mon Aug 19 12:36:18 2013
@@ -574,3 +574,33 @@
         if self.passed == False:
             return
         self.passed = value
+
+
+class TestCaseModule(TestCase):
+    '''
+    The most basic of test objects for a pluggable module. This wraps the TestCase
+    class such that it can be used and configured from YAML.
+    '''
+
+    def __init__(self, test_path='', test_config=None):
+        ''' Constructor
+
+        :param test_path Full path to the test location
+        :param test_config The YAML provided test configuration for this object
+        '''
+        super(TestCaseModule, self).__init__(test_path, test_config)
+        self.asterisk_instances = test_config.get('asterisk-instances') or 1
+        self.connect_ami = test_config.get('connect-ami') or False
+        self.connect_agi = test_config.get('connect-agi') or False
+
+        self.create_asterisk(count=self.asterisk_instances)
+
+    def run(self):
+        ''' The reactor entry point '''
+        super(TestCaseModule, self).run()
+
+        if self.connect_ami:
+            self.create_ami_factory(count=self.asterisk_instances)
+        if self.connect_agi:
+            self.create_fastagi_factory(count=self.asterisk_instances)
+




More information about the asterisk-commits mailing list