[asterisk-commits] qwell: branch qwell/CORS r3924 - in /asterisk/team/qwell/CORS/tests/rest_api/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 18 15:11:23 CDT 2013


Author: qwell
Date: Thu Jul 18 15:11:20 2013
New Revision: 3924

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3924
Log:
Move to 3 instances of Asterisk.  Why won't the test run?  No idea.

Added:
    asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast2/
      - copied from r3923, asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast1/
    asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast3/
      - copied from r3923, asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast1/
Modified:
    asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast1/ari.conf
    asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast2/ari.conf
    asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast2/http.conf
    asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast3/ari.conf
    asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast3/http.conf
    asterisk/team/qwell/CORS/tests/rest_api/CORS/run-test

Modified: asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast1/ari.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast1/ari.conf?view=diff&rev=3924&r1=3923&r2=3924
==============================================================================
--- asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast1/ari.conf (original)
+++ asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast1/ari.conf Thu Jul 18 15:11:20 2013
@@ -2,5 +2,6 @@
 enabled = yes
 allowed_origins = 
 
-[user-cors]
+[cors]
+type=user
 password = cors-pass

Modified: asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast2/ari.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast2/ari.conf?view=diff&rev=3924&r1=3923&r2=3924
==============================================================================
--- asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast2/ari.conf (original)
+++ asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast2/ari.conf Thu Jul 18 15:11:20 2013
@@ -1,6 +1,7 @@
 [general]
 enabled = yes
-allowed_origins = 
+allowed_origins = *
 
-[user-cors]
+[cors]
+type=user
 password = cors-pass

Modified: asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast2/http.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast2/http.conf?view=diff&rev=3924&r1=3923&r2=3924
==============================================================================
--- asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast2/http.conf (original)
+++ asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast2/http.conf Thu Jul 18 15:11:20 2013
@@ -1,3 +1,3 @@
 [general]
 enabled=yes
-bindaddr=127.0.0.1
+bindaddr=127.0.0.2

Modified: asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast3/ari.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast3/ari.conf?view=diff&rev=3924&r1=3923&r2=3924
==============================================================================
--- asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast3/ari.conf (original)
+++ asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast3/ari.conf Thu Jul 18 15:11:20 2013
@@ -1,6 +1,7 @@
 [general]
 enabled = yes
-allowed_origins = 
+allowed_origins = http://example.com,http://127.0.0.3
 
-[user-cors]
+[cors]
+type=user
 password = cors-pass

Modified: asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast3/http.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast3/http.conf?view=diff&rev=3924&r1=3923&r2=3924
==============================================================================
--- asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast3/http.conf (original)
+++ asterisk/team/qwell/CORS/tests/rest_api/CORS/configs/ast3/http.conf Thu Jul 18 15:11:20 2013
@@ -1,3 +1,3 @@
 [general]
 enabled=yes
-bindaddr=127.0.0.1
+bindaddr=127.0.0.3

Modified: asterisk/team/qwell/CORS/tests/rest_api/CORS/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/qwell/CORS/tests/rest_api/CORS/run-test?view=diff&rev=3924&r1=3923&r2=3924
==============================================================================
--- asterisk/team/qwell/CORS/tests/rest_api/CORS/run-test (original)
+++ asterisk/team/qwell/CORS/tests/rest_api/CORS/run-test Thu Jul 18 15:11:20 2013
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 '''
 Copyright (C) 2013, Digium, Inc.
-David M. Lee, II <dlee at digium.com>
+Jason Parker <jparker at digium.com>
 
 This program is free software, distributed under the terms of
 the GNU General Public License Version 2.
@@ -21,12 +21,10 @@
 
 LOGGER = logging.getLogger(__name__)
 
-HOST='localhost'
 PORT=8088
 
 def build_url(*args):
-    return "http://%s:%d/%s" %\
-           (HOST, PORT, '/'.join([str(arg) for arg in args]))
+    return "%s" % '/'.join([str(arg) for arg in args])
 
 class Scenario(object):
     def __init__(self, userpass, method, expected_response):
@@ -38,12 +36,12 @@
         return '{ userpass=%s, method=%s, expected=%d }' % (
             self.userpass, self.method.__name__, self.expected_response)
 
-    def run(self, test, expect_headers):
+    def run(self, test, ast_instance, expect_headers):
         LOGGER.debug("Running %s" % self)
         # api_key auth
-        resp = self.method(build_url('ari', 'channels'),
+        resp = self.method("http://127.0.0.%d:%d/%s" % (self.ast_instance, PORT, build_url('ari', 'channels')),
                            params={'api_key': "%s:%s" % self.userpass},
-                           headers={'Origin': 'http://localhost'})
+                           headers={'Origin': "http://127.0.0.%d" % self.ast_instance})
 
         if self.expected_response != resp.status_code:
             LOGGER.error("Expected %d, got %d (%s). %s" % (
@@ -72,45 +70,21 @@
     def __init__(self):
         TestCase.__init__(self)
         self.passed = True
-        self.create_asterisk()
+        self.create_asterisk(3)
 
     def run(self):
-        self.create_ami_factory()
+        self.run_scenarios(1, False)
+        self.run_scenarios(2, False)
+        self.run_scenarios(3, True)
 
-    def ami_connect(self, ami):
-        self.run_scenarios(False)
+        self.stop_reactor()
 
-        self.replace_config(ami, "ari_star.conf", self.star_reload_finished)
-
-    def run_scenarios(self, expect_headers):
+    def run_scenarios(self, ast_instance, expect_headers):
         for scenario in SCENARIOS:
             if self.passed == False:
                 return
 
-            scenario.run(self, expect_headers)
-
-    def replace_config(self, ami, config, callback):
-        if self.passed == False:
-            return
-
-        src = "%s/tests/%s/%s" % (os.getcwd(), self.realbase, config)
-
-        LOGGER.debug( "Installing replacement configuration %s" % src)
-        self.ast[0].install_config(src, target_filename = "ari.conf")
-
-        message = {'action': 'reload', 'module': 'res_stasis_http.so'}
-
-        ami.sendMessage(message, responseCallback = callback)
-
-    def star_reload_finished(self, received):
-        self.run_scenarios(True)
-
-        self.replace_config(self.ami[0], "ari_multiple.conf", self.multiple_reload_finished)
-
-    def multiple_reload_finished(self, received):
-        self.run_scenarios(True)
-
-        self.stop_reactor()
+            scenario.run(self, self.ast_instance, expect_headers)
 
 def main():
     test = ARICORSTest()




More information about the asterisk-commits mailing list