diff options
| author | Christophe Simonis <chs@openerp.com> | 2014-02-21 10:55:00 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@openerp.com> | 2014-02-21 10:55:00 +0100 |
| commit | b79f35471ecd27f1372849a9fd63cac7f740d2fd (patch) | |
| tree | d9f740bed11e6e2624b76e604a15157d2f1c06f7 /addons/web/static/src | |
| parent | e3bd52897e1637f20c0eed6febd37687f85bfbe9 (diff) | |
[FIX] testing: rpc tests works directly on the source database instead of copying it
bzr revid: chs@openerp.com-20140221095500-5cer5exzdei76y1d
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/testing.js | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/addons/web/static/src/js/testing.js b/addons/web/static/src/js/testing.js index c4f5aeebd60..41dd2f03ad9 100644 --- a/addons/web/static/src/js/testing.js +++ b/addons/web/static/src/js/testing.js @@ -305,39 +305,16 @@ openerp.testing = {}; case 'rpc': async = true; (function () { - // Bunch of random base36 characters - var dbname = 'test_' + Math.random().toString(36).slice(2); - // Add db setup/teardown at the start of the stack + // Add a session setup at the start of the stack to ensure user is logged in case_stack = case_stack.unshift(function (instance) { // FIXME hack: don't want the session to go through shitty loading process of everything instance.session.session_init = testing.noop; instance.session.load_modules = testing.noop; instance.session.session_bind(); - return instance.session.rpc('/web/database/duplicate', { - fields: [ - {name: 'super_admin_pwd', value: db.supadmin}, - {name: 'db_original_name', value: db.source}, - {name: 'db_name', value: dbname} - ] - }).then(function (result) { - if (result.error) { - return $.Deferred().reject(result.error).promise(); - } - return instance.session.session_authenticate( - dbname, 'admin', db.password, true); - }); - }, function (instance) { - return instance.session.rpc('/web/database/drop', { - fields: [ - {name: 'drop_pwd', value: db.supadmin}, - {name: 'drop_db', value: dbname} - ] - }).then(function (result) { - if (result.error) { - return $.Deferred().reject(result.error).promise(); - } - return result; - }); + if (instance.session.session_is_valid()) { + return $.when(); + } + return instance.session.session_authenticate(db.source, 'admin', db.password, true); }); })(); } |
