[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:
parent
636b3ff2dd
commit
d27526d088
|
@ -8,7 +8,7 @@ import operator
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from mako.template import Template
|
from mako.template import Template
|
||||||
from openerp.modules import module, registry
|
from openerp.modules import module
|
||||||
from openerp import http
|
from openerp import http
|
||||||
from openerp.http import request
|
from openerp.http import request
|
||||||
|
|
||||||
|
@ -90,11 +90,7 @@ class TestRunnerController(http.Controller):
|
||||||
|
|
||||||
@http.route('/web/tests', type='http', auth="none")
|
@http.route('/web/tests', type='http', auth="none")
|
||||||
def index(self, mod=None, **kwargs):
|
def index(self, mod=None, **kwargs):
|
||||||
source = kwargs.get('source')
|
ms = module.get_modules()
|
||||||
if source:
|
|
||||||
ms = list(registry.RegistryManager.get(source)._init_modules)
|
|
||||||
else:
|
|
||||||
ms = module.get_modules()
|
|
||||||
manifests = dict(
|
manifests = dict(
|
||||||
(name, desc)
|
(name, desc)
|
||||||
for name, desc in zip(ms, map(self.load_manifest, ms))
|
for name, desc in zip(ms, map(self.load_manifest, ms))
|
||||||
|
|
|
@ -1,21 +1,24 @@
|
||||||
|
import urllib
|
||||||
import urlparse
|
import urlparse
|
||||||
from openerp import sql_db, tools
|
from openerp import sql_db, tools
|
||||||
from qunitsuite.suite import QUnitSuite
|
from qunitsuite.suite import QUnitSuite
|
||||||
|
|
||||||
class WebSuite(QUnitSuite):
|
class WebSuite(QUnitSuite):
|
||||||
def __init__(self):
|
def __init__(self, module):
|
||||||
url = urlparse.urlunsplit([
|
url = urlparse.urlunsplit([
|
||||||
'http',
|
'http',
|
||||||
'localhost:{port}'.format(port=tools.config['xmlrpc_port']),
|
'localhost:{port}'.format(port=tools.config['xmlrpc_port']),
|
||||||
'/web/tests',
|
'/web/tests',
|
||||||
'mod=*&source={db}&supadmin={supadmin}&password={password}'.format(
|
urllib.urlencode({
|
||||||
db=tools.config['db_name'],
|
'mod': module,
|
||||||
supadmin=tools.config['admin_passwd'],
|
'source': tools.config['db_name'],
|
||||||
password='admin'),
|
'supadmin': tools.config['admin_passwd'],
|
||||||
|
'password': 'admin',
|
||||||
|
}),
|
||||||
''
|
''
|
||||||
])
|
])
|
||||||
super(WebSuite, self).__init__(url, 50000)
|
super(WebSuite, self).__init__(url, 50000)
|
||||||
|
|
||||||
def load_tests(loader, standard_tests, _):
|
def load_tests(loader, standard_tests, _):
|
||||||
standard_tests.addTest(WebSuite())
|
standard_tests.addTest(WebSuite('web'))
|
||||||
return standard_tests
|
return standard_tests
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import test_js
|
|
@ -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
|
Loading…
Reference in New Issue