[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
This commit is contained in:
Xavier Morel 2014-02-21 13:45:57 +01:00
parent 636b3ff2dd
commit d27526d088
4 changed files with 19 additions and 12 deletions

View File

@ -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))

View File

@ -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

View File

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
import test_js

View File

@ -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