summaryrefslogtreecommitdiff
path: root/addons/web/static/test/jsonrpc.js
diff options
context:
space:
mode:
authorima-openerp <ima@tinyerp.com>2013-10-21 18:12:22 +0530
committerima-openerp <ima@tinyerp.com>2013-10-21 18:12:22 +0530
commit7678ea996fbf0fcd146bd7ffbf75ab450db7dd4e (patch)
treea854e1029302edfe582f594bc2f684aaeec9e45d /addons/web/static/test/jsonrpc.js
parent8acd61c43e7d47f3c83d19aa3c3f1d4fd4547c10 (diff)
parentebeeae0ed4c57e36db143c11de11174ca1330892 (diff)
[MERGE]with trunk.
bzr revid: ima@tinyerp.com-20131021124222-7j3xc1ahtek5gyuw
Diffstat (limited to 'addons/web/static/test/jsonrpc.js')
-rw-r--r--addons/web/static/test/jsonrpc.js66
1 files changed, 48 insertions, 18 deletions
diff --git a/addons/web/static/test/jsonrpc.js b/addons/web/static/test/jsonrpc.js
index a8b901d3b1c..46b7ceeac6e 100644
--- a/addons/web/static/test/jsonrpc.js
+++ b/addons/web/static/test/jsonrpc.js
@@ -111,27 +111,54 @@ function (test) {
notEqual(result, origin_tmp, "Values in the different sessions should be different");
});
});*/
+ test('timeout-jsonrpc', {asserts: 1}, function () {
+ var session = new openerp.Session();
+ return session.rpc("/gen_session_id", {}, {timeout: 1}).then(function() {
+ ok(false, "the request incorrectly succeeded");
+ return $.when();
+ }, function(a, e) {
+ e.preventDefault();
+ ok(true, "the request correctly failed");
+ return $.when();
+ });
+ });
+ test('timeout-jsonprpc', {asserts: 1}, function () {
+ var session = new openerp.Session();
+ session.origin_server = false;
+ return session.rpc("/gen_session_id", {}, {timeout: 1}).then(function() {
+ ok(false, "the request incorrectly succeeded");
+ return $.when();
+ }, function(a, e) {
+ e.preventDefault();
+ ok(true, "the request correctly failed");
+ return $.when();
+ });
+ });
+ // desactivated because the phantomjs runner crash
+ /*test('timeout-jsonprpc2', {asserts: 1}, function () {
+ var session = new openerp.Session();
+ session.origin_server = false;
+ return session.rpc("/gen_session_id", {}, {force2step: true, timeout: 1}).then(function() {
+ ok(false, "the request incorrectly succeeded");
+ return $.when();
+ }, function(a, e) {
+ e.preventDefault();
+ ok(true, "the request correctly failed");
+ return $.when();
+ });
+ });*/
});
-
-// desactivated because I can't manage to make these work in the runbot
-/*
var login = "admin";
var password = "admin";
-var db = null;
ropenerp.testing.section('jsonrpc-auth', {
- setup: function() {
- var session = new openerp.Session();
- return session.session_reload().then(function() {
- db = session.db;
- ok(db, "db must be valid");
- });
- },
+ rpc: "rpc",
},
function (test) {
- test('basic-auth', {asserts: 4}, function () {
- var session = new openerp.Session();
+ test('basic-auth', {asserts: 3}, function () {
+ var db = ropenerp.session.db;
+ var session = new openerp.Session(null, null, {override_session: true});
equal(session.uid, undefined, "uid is expected to be undefined");
return session.session_authenticate(db, login, password).then(function() {
equal(session.uid, 1, "Admin's uid must be 1");
@@ -145,14 +172,16 @@ function (test) {
});
});
});
- test('share-sessions', {asserts: 7}, function () {
- var session = new openerp.Session();
+ test('share-sessions', {asserts: 6}, function () {
+ var db = ropenerp.session.db;
+ var session = new openerp.Session(null, null, {override_session: true});
var session2;
return session.session_authenticate(db, login, password).then(function() {
equal(session.uid, 1, "Admin's uid must be 1");
session2 = new openerp.Session(null, null, {session_id: session.session_id});
equal(session2.uid, undefined, "uid should be undefined");
equal(session2.override_session, true, "overwrite_session should be true");
+ console.log("session_id", session.session_id);
return session2.session_reload();
}).then(function() {
equal(session2.uid, session.uid);
@@ -167,8 +196,9 @@ function (test) {
});
});
});
- test('models', {asserts: 3}, function () {
- var session = new openerp.Session();
+ test('models', {asserts: 2}, function () {
+ var db = ropenerp.session.db;
+ var session = new openerp.Session(null, null, {override_session: true});
return session.session_authenticate(db, login, password).then(function() {
return session.model("res.users").call("search_read", {fields: ["login"], domain: [["id", "=", 1]]});
}).then(function(result) {
@@ -176,6 +206,6 @@ function (test) {
equal(result[0].login, "admin", "Must have admin's login");
});
});
-});*/
+});
})();