diff options
| author | niv-openerp <nicolas.vanhoren@openerp.com> | 2013-07-26 15:18:05 +0200 |
|---|---|---|
| committer | niv-openerp <nicolas.vanhoren@openerp.com> | 2013-07-26 15:18:05 +0200 |
| commit | 5c7b6cffdecbdc632bcb47a3c420a173e797c53c (patch) | |
| tree | 1ae2b1fbe48a7e75c64ffcc83fbc6ec49b0b5c8c /addons/web/static/src/js | |
| parent | c94c4599b2a1e76664db8558bcd973ac6250e18f (diff) | |
Fixed some problems about testing framework
bzr revid: nicolas.vanhoren@openerp.com-20130726131805-wstt1de2qqq7w7hx
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/testing.js | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/addons/web/static/src/js/testing.js b/addons/web/static/src/js/testing.js index ed26238028e..d3a9a538dd9 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)) { @@ -240,36 +242,10 @@ 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); - }); + var instance = openerp; + if (!openerp_inited) { + openerp.init(module_deps); + openerp_inited = true; } if (instance.session) { instance.session.uid = 42; |
