1
0
mirror of http://git.whoc.org.uk/git/password-manager.git synced 2024-11-14 08:39:01 +01:00

Added a test to verify that 'cloneRecord' will fail when there are already pending changes.

This commit is contained in:
Giulio Cesare Solaroli 2014-08-27 09:14:08 +02:00
parent acf5363fe2
commit 44c51770d9

View File

@ -2020,13 +2020,11 @@ console.log("PROXY", proxy);
var deferredResult; var deferredResult;
var proxy; var proxy;
var user; var user;
var user2;
var recordID; var recordID;
var clonedRecordID; var clonedRecordID;
proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false}); proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false});
user = new Clipperz.PM.DataModel.User({username:'joe', getPassphraseFunction:function () { return 'clipperz';}}); user = new Clipperz.PM.DataModel.User({username:'joe', getPassphraseFunction:function () { return 'clipperz';}});
user2 = new Clipperz.PM.DataModel.User({username:'joe', getPassphraseFunction:function () { return 'clipperz';}});
recordID = '13a5e52976337ab210903cd04872588e1b21fb72bc183e91aa25c494b8138551'; recordID = '13a5e52976337ab210903cd04872588e1b21fb72bc183e91aa25c494b8138551';
@ -2088,6 +2086,49 @@ console.log("PROXY", proxy);
}, },
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
'cloneRecordWithPendingChanges_test': function (someTestArgs) {
var deferredResult;
var proxy;
var user;
var recordID;
var clonedRecordID;
proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false});
user = new Clipperz.PM.DataModel.User({username:'joe', getPassphraseFunction:function () { return 'clipperz';}});
recordID = '13a5e52976337ab210903cd04872588e1b21fb72bc183e91aa25c494b8138551';
deferredResult = new Clipperz.Async.Deferred("cloneRecord_test", someTestArgs);
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['joe_clipperz_offline_copy_data']);
deferredResult.addMethod(user, 'login');
deferredResult.addMethod(user, 'getRecords');
deferredResult.addCallback(MochiKit.Base.itemgetter('length'));
deferredResult.addTest(20, "This account has 20 cards");
deferredResult.addMethod(user, 'getRecord', recordID);
deferredResult.addMethodcaller('setLabel', "new value");
deferredResult.addMethod(user, 'getRecord', recordID);
deferredResult.addMethodcaller('hasPendingChanges');
deferredResult.addTest(true, "The record has pending changes.");
deferredResult.addMethod(user, 'hasPendingChanges');
deferredResult.addTest(true, "Also the user has pending changes.");
deferredResult.addMethod(user, 'getRecord', recordID);
deferredResult.addMethod(user, 'cloneRecord');
deferredResult.addCallbacks(
MochiKit.Base.partial(SimpleTest.ok, false, "An exception should have been thrown"),
MochiKit.Base.partial(SimpleTest.ok, true, "An exception should have been thrown")
);
deferredResult.callback();
return deferredResult;
},
//-------------------------------------------------------------------------
/* /*
'rearrangeRecordFieldOrderAndSave_test': function (someTestArgs) { 'rearrangeRecordFieldOrderAndSave_test': function (someTestArgs) {
var deferredResult; var deferredResult;