diff --git a/addons/web/__openerp__.py b/addons/web/__openerp__.py
index a8bef3f009c..a4000856afe 100644
--- a/addons/web/__openerp__.py
+++ b/addons/web/__openerp__.py
@@ -17,19 +17,4 @@ This module provides the core of the OpenERP Web Client.
'qweb' : [
"static/src/xml/*.xml",
],
- 'test': [
- "static/test/testing.js",
- "static/test/framework.js",
- "static/test/registry.js",
- "static/test/form.js",
- "static/test/data.js",
- "static/test/list-utils.js",
- "static/test/formats.js",
- "static/test/rpc-misordered.js",
- "static/test/evals.js",
- "static/test/search.js",
- "static/test/list.js",
- "static/test/list-editable.js",
- "static/test/mutex.js"
- ],
}
diff --git a/addons/web/controllers/__init__.py b/addons/web/controllers/__init__.py
index 74c27518ece..12a7e529b67 100644
--- a/addons/web/controllers/__init__.py
+++ b/addons/web/controllers/__init__.py
@@ -1,2 +1 @@
from . import main
-from . import testing
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py
index d56eecec53e..f85f8be49fe 100644
--- a/addons/web/controllers/main.py
+++ b/addons/web/controllers/main.py
@@ -619,7 +619,6 @@ class Home(http.Controller):
return make_conditional(
response, bundle.last_modified, bundle.checksum, max_age=60*5)
-
class WebClient(http.Controller):
@http.route('/web/webclient/csslist', type='json', auth="none")
@@ -707,6 +706,10 @@ class WebClient(http.Controller):
def version_info(self):
return openerp.service.common.exp_version()
+ @http.route('/web/tests', type='http', auth="none")
+ def index(self, mod=None, **kwargs):
+ return request.render('web.qunit_suite')
+
class Proxy(http.Controller):
@http.route('/web/proxy/load', type='json', auth="none")
diff --git a/addons/web/controllers/testing.py b/addons/web/controllers/testing.py
deleted file mode 100644
index 34a0a15427f..00000000000
--- a/addons/web/controllers/testing.py
+++ /dev/null
@@ -1,172 +0,0 @@
-# coding=utf-8
-# -*- encoding: utf-8 -*-
-
-import glob
-import itertools
-import json
-import operator
-import os
-
-import openerp
-from mako.template import Template
-from openerp.modules import module
-from openerp import http
-from openerp.addons.web.controllers.main import ensure_db
-from openerp.http import request
-
-from .main import module_topological_sort
-
-NOMODULE_TEMPLATE = Template(u"""
-
-
-
-
- OpenERP Testing
-
-
-
-
-
-""", default_filters=['h'])
-NOTFOUND = Template(u"""
-Unable to find the module [${module}], please check that the module
- name is correct and the module is on OpenERP's path.
-<< Back to tests
-""", default_filters=['h'])
-TESTING = Template(u"""
-
-<%def name="to_path(module, p)">/${module}/${p}%def>
-
-
-
- OpenERP Web Tests
-
-
-
-
-
-
-
-
-
-
-
-
-${bundle('web.assets_backend') | n}
-% for module, jss, tests, templates in files:
- % for js in jss:
- % if not js.endswith('/apps.js'):
-
- % endif
- % endfor
- % if tests or templates:
-
- % endif
- % if tests:
- % for test in tests:
-
- % endfor
- % endif
-% endfor
-
-""", default_filters=['h'])
-
-class TestRunnerController(http.Controller):
-
- @http.route('/web/tests', type='http', auth="none")
- def index(self, mod=None, **kwargs):
- ms = module.get_modules()
- manifests = dict(
- (name, desc)
- for name, desc in zip(ms, map(self.load_manifest, ms))
- if desc # remove not-actually-openerp-modules
- )
-
- if not mod:
- return NOMODULE_TEMPLATE.render(modules=(
- (manifest['name'], name)
- for name, manifest in manifests.iteritems()
- if any(testfile.endswith('.js')
- for testfile in manifest['test'])
- ))
- sorted_mods = module_topological_sort(dict(
- (name, manifest.get('depends', []))
- for name, manifest in manifests.iteritems()
- ))
- # to_load and to_test should be zippable lists of the same length.
- # A falsy value in to_test indicate nothing to test at that index (just
- # load the corresponding part of to_load)
- to_test = sorted_mods
- if mod != '*':
- if mod not in manifests:
- return request.not_found(NOTFOUND.render(module=mod))
- idx = sorted_mods.index(mod)
- to_test = [None] * len(sorted_mods)
- to_test[idx] = mod
-
- tests_candicates = [
- filter(lambda path: path.endswith('.js'),
- manifests[mod]['test'] if mod else [])
- for mod in to_test]
- # remove trailing test-less modules
- tests = reversed(list(
- itertools.dropwhile(
- operator.not_,
- reversed(tests_candicates))))
-
- files = [
- (mod, manifests[mod]['js'], tests, manifests[mod]['qweb'])
- for mod, tests in itertools.izip(sorted_mods, tests)
- ]
-
- def bundle(xmlid):
- dbname = request.params['source']
- registry = openerp.registry(dbname)
- view_obj = registry["ir.ui.view"]
- uid = openerp.SUPERUSER_ID
- return view_obj.render(registry.cursor(), uid, xmlid, context=request.context)
-
- return TESTING.render(bundle=bundle, files=files, dependencies=json.dumps(
- [name for name in sorted_mods
- if module.get_module_resource(name, 'static')
- # TODO fme: find a way to detect modules with js bundles
- # if manifests[name]['js']
- ]))
-
-
- def load_manifest(self, name):
- manifest = module.load_information_from_description_file(name)
- if manifest:
- path = module.get_module_path(name)
- manifest['js'] = list(
- self.expand_patterns(path, manifest.get('js', [])))
- manifest['test'] = list(
- self.expand_patterns(path, manifest.get('test', [])))
- manifest['qweb'] = list(
- self.expand_patterns(path, manifest.get('qweb', [])))
- return manifest
-
- def expand_patterns(self, root, patterns):
- for pattern in patterns:
- normalized_pattern = os.path.normpath(os.path.join(root, pattern))
- for path in glob.glob(normalized_pattern):
- # replace OS path separators (from join & normpath) by URI ones
- yield path[len(root):].replace(os.path.sep, '/')
-
diff --git a/addons/web/static/src/js/testing.js b/addons/web/static/src/js/testing.js
index 1f1c718ad5f..5e9483addc1 100644
--- a/addons/web/static/src/js/testing.js
+++ b/addons/web/static/src/js/testing.js
@@ -48,15 +48,6 @@ openerp.testing = {};
testing.dependencies = window['oe_all_dependencies'] || [];
testing.current_module = null;
- testing.templates = { };
- testing.add_template = function (name) {
- var xhr = QWeb2.Engine.prototype.get_xhr();
- xhr.open('GET', name, false);
- xhr.send(null);
- (testing.templates[testing.current_module] =
- testing.templates[testing.current_module] || [])
- .push(xhr.responseXML);
- };
/**
* Function which does not do anything
*/
@@ -206,7 +197,7 @@ openerp.testing = {};
teardown: testing.noop
});
- QUnit.module(testing.current_module + '.' + name, {_oe: options});
+ QUnit.module(name, {_oe: options});
body(testing['case']);
};
testing['case'] = function (name, options, callback) {
@@ -244,18 +235,6 @@ openerp.testing = {};
expect(opts.asserts);
}
- if (opts.templates) {
- for(var i=0; i
+
+ <!DOCTYPE html>
+
+
+
+
+ OpenERP Web Tests
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/web_tests_demo/__openerp__.py b/addons/web_tests_demo/__openerp__.py
index cccc7e0b4da..e753d2f5e5e 100644
--- a/addons/web_tests_demo/__openerp__.py
+++ b/addons/web_tests_demo/__openerp__.py
@@ -11,6 +11,5 @@ Test suite example, same code as that used in the testing documentation.
'data' : [
'views/web_tests_demo.xml',
],
- 'test': ['static/test/demo.js'],
'qweb': ['static/src/xml/demo.xml'],
}
diff --git a/addons/web_tests_demo/static/src/js/demo.js b/addons/web_tests_demo/static/src/js/demo.js
index 506808027cc..9ac8d395784 100644
--- a/addons/web_tests_demo/static/src/js/demo.js
+++ b/addons/web_tests_demo/static/src/js/demo.js
@@ -1,11 +1,12 @@
// static/src/js/demo.js
-openerp.web_tests_demo = function (instance) {
- _.extend(instance.web_tests_demo, {
+(function () {
+ openerp.web_tests_demo = {
value_true: true,
- SomeType: instance.web.Class.extend({
+ SomeType: openerp.web.Class.extend({
init: function (value) {
this.value = value;
}
})
- });
-};
+ };
+
+}());
diff --git a/addons/web_tests_demo/views/web_tests_demo.xml b/addons/web_tests_demo/views/web_tests_demo.xml
index 9e9208504c0..75d5670484a 100644
--- a/addons/web_tests_demo/views/web_tests_demo.xml
+++ b/addons/web_tests_demo/views/web_tests_demo.xml
@@ -8,5 +8,10 @@
+
+
+
+
+