diff options
| author | niv-openerp <nicolas.vanhoren@openerp.com> | 2013-07-31 18:34:15 +0200 |
|---|---|---|
| committer | niv-openerp <nicolas.vanhoren@openerp.com> | 2013-07-31 18:34:15 +0200 |
| commit | dae87b45352d18f91a8e27b0b868c4fd8ef3a1b0 (patch) | |
| tree | 2d3f5c5e492146bcd5a008e00f83ca51024dde06 /addons/web/static/src/js/testing.js | |
| parent | a51e0424004dcd3d06e34bd023cc08acca4218d8 (diff) | |
Try to reimplement jsonrpc with niv's methods, still a lot of tests fail
bzr revid: nicolas.vanhoren@openerp.com-20130731163415-v6ec0nqsr0qj91a6
Diffstat (limited to 'addons/web/static/src/js/testing.js')
| -rw-r--r-- | addons/web/static/src/js/testing.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/addons/web/static/src/js/testing.js b/addons/web/static/src/js/testing.js index af434c4c0f4..54ffe8ce408 100644 --- a/addons/web/static/src/js/testing.js +++ b/addons/web/static/src/js/testing.js @@ -53,25 +53,28 @@ openerp.testing = {}; testing.mockifyRPC = function (instance, responses) { var session = instance.session; session.responses = responses || {}; - session.rpc_function = function (url, payload) { + session.rpc = function(url, rparams, options) { + if (_.isString(url)) { + url = {url: url}; + } var fn, params; - var needle = payload.params.model + ':' + payload.params.method; + var needle = rparams.model + ':' + rparams.method; if (url.url === '/web/dataset/call_kw' && needle in this.responses) { fn = this.responses[needle]; params = [ - payload.params.args || [], - payload.params.kwargs || {} + rparams.args || [], + rparams.kwargs || {} ]; } else { fn = this.responses[url.url]; - params = [payload]; + params = [{params: rparams}]; } if (!fn) { return $.Deferred().reject({}, 'failed', _.str.sprintf("Url %s not found in mock responses, with arguments %s", - url.url, JSON.stringify(payload.params)) + url.url, JSON.stringify(rparams)) ).promise(); } try { |
