diff options
| author | Christophe Matthieu <chm@openerp.com> | 2013-08-01 16:42:29 +0200 |
|---|---|---|
| committer | Christophe Matthieu <chm@openerp.com> | 2013-08-01 16:42:29 +0200 |
| commit | 55e3a0dedd98b512ec6f649d5ff645add53c38ab (patch) | |
| tree | eb560d79393be4f6329bc3630bce12b11177c456 /addons/web/static/src/js/testing.js | |
| parent | 25f117a0561cef866f21c5360cd09ab32066b96b (diff) | |
| parent | be7b1239c33c24f2727216eebf1d5f9907c54046 (diff) | |
[MERGE] from trunk-website-public_uid-chm
bzr revid: chm@openerp.com-20130801144229-tibuoa574kn86kyy
Diffstat (limited to 'addons/web/static/src/js/testing.js')
| -rw-r--r-- | addons/web/static/src/js/testing.js | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/addons/web/static/src/js/testing.js b/addons/web/static/src/js/testing.js index ed26238028e..880da9f1bc1 100644 --- a/addons/web/static/src/js/testing.js +++ b/addons/web/static/src/js/testing.js @@ -164,6 +164,8 @@ openerp.testing = {}; }); }; + var openerp_inited = false; + var db = window['oe_db_info']; testing.section = function (name, options, body) { if (_.isFunction(options)) { @@ -193,8 +195,7 @@ openerp.testing = {}; 0, module_index + 1 || undefined); // Serialize options for this precise test case - // WARNING: typo is from jquery, do not fix! - var env = QUnit.config.currentModuleTestEnviroment; + var env = QUnit.config.currentModuleTestEnvironment; // section setup // case setup // test @@ -240,40 +241,13 @@ openerp.testing = {}; } QUnit.test(name, function () { - var instance; - if (!opts.dependencies) { - instance = openerp.init(module_deps); - } else { - // empty-but-specified dependencies actually allow running - // without loading any module into the instance - - // TODO: clean up this mess - var d = opts.dependencies.slice(); - // dependencies list should be in deps order, reverse to make - // loading order from last - d.reverse(); - var di = 0; - while (di < d.length) { - var m = /^web\.(\w+)$/.exec(d[di]); - if (m) { - d[di] = m[1]; - } - d.splice.apply(d, [di+1, 0].concat( - _(dependencies[d[di]]).reverse())); - ++di; - } - - instance = openerp.init(null); - _(d).chain() - .reverse() - .uniq() - .each(function (module) { - openerp.web[module](instance); - }); - } - if (instance.session) { - instance.session.uid = 42; + var instance = openerp; + if (!openerp_inited) { + openerp.init(module_deps); + openerp_inited = true; } + instance.session = new instance.web.Session(); + instance.session.uid = 42; if (_.isNumber(opts.asserts)) { expect(opts.asserts); } |
