From d27526d088653a5f9e892a1fe48829724274d8ee Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 21 Feb 2014 13:45:57 +0100 Subject: [PATCH] [IMP] JS unit tests split automated suite so web only runs its own JS tests, and web_tests_demo runs its own. Also reversed changes to index. todo: use hack cursor thing? bzr revid: xmo@openerp.com-20140221124557-s875nj0xrf2t85i9 --- addons/web/controllers/testing.py | 8 ++------ addons/web/tests/test_js.py | 15 +++++++++------ addons/web_tests_demo/tests/__init__.py | 2 ++ addons/web_tests_demo/tests/test_js.py | 6 ++++++ 4 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 addons/web_tests_demo/tests/__init__.py create mode 100644 addons/web_tests_demo/tests/test_js.py diff --git a/addons/web/controllers/testing.py b/addons/web/controllers/testing.py index f58482f7759..598270cfe54 100644 --- a/addons/web/controllers/testing.py +++ b/addons/web/controllers/testing.py @@ -8,7 +8,7 @@ import operator import os from mako.template import Template -from openerp.modules import module, registry +from openerp.modules import module from openerp import http from openerp.http import request @@ -90,11 +90,7 @@ class TestRunnerController(http.Controller): @http.route('/web/tests', type='http', auth="none") def index(self, mod=None, **kwargs): - source = kwargs.get('source') - if source: - ms = list(registry.RegistryManager.get(source)._init_modules) - else: - ms = module.get_modules() + ms = module.get_modules() manifests = dict( (name, desc) for name, desc in zip(ms, map(self.load_manifest, ms)) diff --git a/addons/web/tests/test_js.py b/addons/web/tests/test_js.py index 0d4a9f35a85..0bab1de96a5 100644 --- a/addons/web/tests/test_js.py +++ b/addons/web/tests/test_js.py @@ -1,21 +1,24 @@ +import urllib import urlparse from openerp import sql_db, tools from qunitsuite.suite import QUnitSuite class WebSuite(QUnitSuite): - def __init__(self): + def __init__(self, module): url = urlparse.urlunsplit([ 'http', 'localhost:{port}'.format(port=tools.config['xmlrpc_port']), '/web/tests', - 'mod=*&source={db}&supadmin={supadmin}&password={password}'.format( - db=tools.config['db_name'], - supadmin=tools.config['admin_passwd'], - password='admin'), + urllib.urlencode({ + 'mod': module, + 'source': tools.config['db_name'], + 'supadmin': tools.config['admin_passwd'], + 'password': 'admin', + }), '' ]) super(WebSuite, self).__init__(url, 50000) def load_tests(loader, standard_tests, _): - standard_tests.addTest(WebSuite()) + standard_tests.addTest(WebSuite('web')) return standard_tests diff --git a/addons/web_tests_demo/tests/__init__.py b/addons/web_tests_demo/tests/__init__.py new file mode 100644 index 00000000000..1db9e399fd2 --- /dev/null +++ b/addons/web_tests_demo/tests/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +import test_js diff --git a/addons/web_tests_demo/tests/test_js.py b/addons/web_tests_demo/tests/test_js.py new file mode 100644 index 00000000000..fb97176bad2 --- /dev/null +++ b/addons/web_tests_demo/tests/test_js.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +from openerp.addons.web.tests.test_js import WebSuite + +def load_tests(loader, standard_tests, _): + standard_tests.addTest(WebSuite('web_tests_demo')) + return standard_tests