[FIX] deferred.pipe -> deferred.then
bzr revid: xmo@openerp.com-20121116101417-mkcjrdtocl6w7408
This commit is contained in:
parent
0d85c24ae3
commit
796e80ec2d
|
@ -367,7 +367,7 @@ To do this, set the :js:attr:`rpc option <TestOptions.rpc>` to
|
|||
|
||||
// actual test code
|
||||
return new instance.web.Model('people.famous')
|
||||
.call('name_search', {name: 'bob'}).pipe(function (result) {
|
||||
.call('name_search', {name: 'bob'}).then(function (result) {
|
||||
strictEqual(result.length, 3, "shoud return 3 people");
|
||||
strictEqual(result[0][1], "Microsoft Bob",
|
||||
"the most famous bob should be Microsoft Bob");
|
||||
|
@ -397,7 +397,7 @@ To do this, set the :js:attr:`rpc option <TestOptions.rpc>` to
|
|||
// widget needs that or it blows up
|
||||
instance.webclient = {toggle_bars: openerp.testing.noop};
|
||||
var dbm = new instance.web.DatabaseManager({});
|
||||
return dbm.appendTo($s).pipe(function () {
|
||||
return dbm.appendTo($s).then(function () {
|
||||
ok(fetched_dbs, "should have fetched databases");
|
||||
ok(fetched_langs, "should have fetched languages");
|
||||
deepEqual(dbm.db_list, ['foo', 'bar', 'baz']);
|
||||
|
@ -446,9 +446,9 @@ then the actual test::
|
|||
test('actual RPC', {rpc: 'rpc', asserts: 4}, function (instance) {
|
||||
var Model = new instance.web.Model('web_tests_demo.model');
|
||||
return Model.call('create', [{name: "Bob"}])
|
||||
.pipe(function (id) {
|
||||
.then(function (id) {
|
||||
return Model.call('read', [[id]]);
|
||||
}).pipe(function (records) {
|
||||
}).then(function (records) {
|
||||
strictEqual(records.length, 1);
|
||||
var record = records[0];
|
||||
strictEqual(record.name, "Bob");
|
||||
|
|
|
@ -74,7 +74,7 @@ openerp.testing = {};
|
|||
).promise();
|
||||
}
|
||||
try {
|
||||
return $.when(fn.apply(null, params)).pipe(function (result) {
|
||||
return $.when(fn.apply(null, params)).then(function (result) {
|
||||
// Wrap for RPC layer unwrapper thingy
|
||||
return {result: result};
|
||||
});
|
||||
|
@ -121,7 +121,7 @@ openerp.testing = {};
|
|||
} catch (e) {
|
||||
actual_call = $.Deferred().reject(e);
|
||||
}
|
||||
actual_call.pipe(success, failure);
|
||||
actual_call.then(success, failure);
|
||||
}
|
||||
};
|
||||
var teardown = function () {
|
||||
|
@ -320,7 +320,7 @@ openerp.testing = {};
|
|||
{name: 'db_original_name', value: db.source},
|
||||
{name: 'db_name', value: dbname}
|
||||
]
|
||||
}).pipe(function (result) {
|
||||
}).then(function (result) {
|
||||
if (result.error) {
|
||||
return $.Deferred().reject(result.error).promise();
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ openerp.testing = {};
|
|||
{name: 'drop_pwd', value: db.supadmin},
|
||||
{name: 'drop_db', value: dbname}
|
||||
]
|
||||
}).pipe(function (result) {
|
||||
}).then(function (result) {
|
||||
if (result.error) {
|
||||
return $.Deferred().reject(result.error).promise();
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ openerp.testing.section('testing.stack', function (test) {
|
|||
var s = openerp.testing.Stack();
|
||||
return s.execute(function () {
|
||||
throw new Error("foo");
|
||||
}).pipe(reject, function (f) {
|
||||
}).then(reject, function (f) {
|
||||
strictEqual(f.message, "foo", "should reject with exception");
|
||||
return $.when();
|
||||
});
|
||||
|
@ -39,7 +39,7 @@ openerp.testing.section('testing.stack', function (test) {
|
|||
return $.Deferred(function (d) {
|
||||
d.reject("failed");
|
||||
});
|
||||
}).pipe(reject, function (f) {
|
||||
}).then(reject, function (f) {
|
||||
strictEqual(f, "failed", "should propagate failure");
|
||||
return $.when();
|
||||
});
|
||||
|
@ -194,7 +194,7 @@ openerp.testing.section('testing.stack', function (test) {
|
|||
}).execute(function () {
|
||||
code = true;
|
||||
return 42;
|
||||
}).pipe(reject, function (m) {
|
||||
}).then(reject, function (m) {
|
||||
ok(setup, "should have executed first setup function");
|
||||
ok(teardown, "should have executed first teardown function");
|
||||
ok(!teardown2, "should not have executed second teardown function");
|
||||
|
@ -215,7 +215,7 @@ openerp.testing.section('testing.stack', function (test) {
|
|||
return $.Deferred().reject('Fail 3');
|
||||
}).execute(function () {
|
||||
return 42;
|
||||
}).pipe(reject, function (m) {
|
||||
}).then(reject, function (m) {
|
||||
strictEqual(teardowns, 3,
|
||||
"should have tried executing all teardowns");
|
||||
strictEqual(m, "Fail 3", "should return first failure message");
|
||||
|
@ -231,7 +231,7 @@ openerp.testing.section('testing.stack', function (test) {
|
|||
return $.Deferred().reject('Fail 2');
|
||||
}).execute(function () {
|
||||
return $.Deferred().reject("code");
|
||||
}).pipe(reject, function (m) {
|
||||
}).then(reject, function (m) {
|
||||
strictEqual(teardowns, 2,
|
||||
"should have tried executing all teardowns");
|
||||
strictEqual(m, "code", "should return first failure message");
|
||||
|
|
|
@ -58,7 +58,7 @@ openerp.testing.section('basic section', function (test) {
|
|||
];
|
||||
});
|
||||
return new instance.web.Model('people.famous')
|
||||
.call('name_search', {name: 'bob'}).pipe(function (result) {
|
||||
.call('name_search', {name: 'bob'}).then(function (result) {
|
||||
strictEqual(result.length, 3, "shoud return 3 people");
|
||||
strictEqual(result[0][1], "Microsoft Bob",
|
||||
"the most famous bob should be Microsoft Bob");
|
||||
|
@ -78,7 +78,7 @@ openerp.testing.section('basic section', function (test) {
|
|||
// widget needs that or it blows up
|
||||
instance.webclient = {toggle_bars: openerp.testing.noop};
|
||||
var dbm = new instance.web.DatabaseManager({});
|
||||
return dbm.appendTo($s).pipe(function () {
|
||||
return dbm.appendTo($s).then(function () {
|
||||
ok(fetched_dbs, "should have fetched databases");
|
||||
ok(fetched_langs, "should have fetched languages");
|
||||
deepEqual(dbm.db_list, ['foo', 'bar', 'baz']);
|
||||
|
@ -88,9 +88,9 @@ openerp.testing.section('basic section', function (test) {
|
|||
test('actual RPC', {rpc: 'rpc', asserts: 4}, function (instance) {
|
||||
var Model = new instance.web.Model('web_tests_demo.model');
|
||||
return Model.call('create', [{name: "Bob"}])
|
||||
.pipe(function (id) {
|
||||
.then(function (id) {
|
||||
return Model.call('read', [[id]]);
|
||||
}).pipe(function (records) {
|
||||
}).then(function (records) {
|
||||
strictEqual(records.length, 1);
|
||||
var record = records[0];
|
||||
strictEqual(record.name, "Bob");
|
||||
|
|
Loading…
Reference in New Issue