Interim synchronization with internal repository
This is an intermir commit to share what is going on with the development of the new /delta version.
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2013 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz, the online password manager.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com.
|
||||
|
||||
* Clipperz is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
* Clipperz is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Clipperz. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.DataModel.DirectLogin - test</title>
|
||||
<script>Clipperz = {}</script>
|
||||
<script type="text/javascript" src="../../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../../../js/React/react-with-addons-0.10.0.js"></script>
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../../../SimpleTest/test.css">
|
||||
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/YUI/Utils.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Date.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/ByteArray.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Logging.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Async.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Signal.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/KeyValueObjectStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/BigInt.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/AES.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/AES_2.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SHA.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/PRNG.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SRP.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Toll.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Offline.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Test.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Connection.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Crypto.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings/Strings_en-US.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Date.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/EncryptedRemoteObject.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.Version.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.Version.Field.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLogin.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginInput.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginBinding.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.Legacy.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.RecordIndex.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.Preferences.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/OneTimePassword.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.AccountInfo.js'></script>
|
||||
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.Async.js"></script>
|
||||
<script>
|
||||
Clipperz_IEisBroken = false;
|
||||
</script>
|
||||
|
||||
<!--[if IE]><script>
|
||||
Clipperz_IEisBroken = true;
|
||||
Clipperz_normalizedNewLine = '\x0d\x0a';
|
||||
</script><![endif]-->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id="test">
|
||||
<script>
|
||||
Clipperz.PM.Strings.Languages.setSelectedLanguage('en-us');
|
||||
</script>
|
||||
<script type="text/javascript" src="User.data.js"></script>
|
||||
<script type="text/javascript" src="User.data.old.js"></script>
|
||||
<script type="text/javascript" src="DirectLogin.test.js"></script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,190 @@
|
||||
/*
|
||||
|
||||
Copyright 2008-2013 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz, the online password manager.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com.
|
||||
|
||||
* Clipperz is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
* Clipperz is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Clipperz. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
*/
|
||||
|
||||
Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose();
|
||||
|
||||
var tests = {
|
||||
|
||||
/*
|
||||
user = new Clipperz.PM.DataModel.User({username:'test', getPassphraseFunction:function () { return 'test';}});
|
||||
...
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['test_test_offline_copy_data']);
|
||||
deferredResult.addMethod(user, 'getRecord', '8280842f41162b673335b63860637e8472e8bbff0efa2bc78b0dbc5e09712e13');
|
||||
|
||||
|
||||
user = new Clipperz.PM.DataModel.User({username:'joe', getPassphraseFunction:function () { return 'clipperz';}});
|
||||
...
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['joe_clipperz_offline_copy_data']);
|
||||
deferredResult.addMethod(user, 'getRecord', '5cdac63b317f3942da38f3a3de3b7f0e5d6678200951c6216230295550f63fb4'); // WEB PASSWORD (0)
|
||||
deferredResult.addMethod(user, 'getRecord', '36ec1a41118813ced3553534fa2607d781cba687768db305beed368a8e06e113'); // DIGG (1)
|
||||
deferredResult.addMethod(user, 'getRecord', 'c0ce9130ca365bb02418d4305ea1d29e49c3f0e96d44b9d3cb6b4b6843d25065'); // SAP (2)
|
||||
deferredResult.addMethod(user, 'getRecord', 'd5f700b9c3367c39551ea49e00a9ab20dae09dd79d46047b983fc7c4bfaa050d'); // YAHOO (4)
|
||||
DirectLogin references
|
||||
- dba0db679802f0e6aa6d0b7a6aaf42350aabc5f057409edd99a268a92ebb6496 // Yahoo! Mail
|
||||
- aa18149164302d5dbe7e2d3724565b9550e00887b49978559783b2e38c625584 // (Yahoo! Groups)
|
||||
- 6f7bbc4e42ea462b5246e6f51c3f86056bec50601ce2de6067c8c1d26f21c07f // (Flickr)
|
||||
- a7b32e72502804bf2946a2a8856139cbbb759c5777e6b3e673db1fdf7e3bd06e // (My Yahoo!)
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'editDirectLoginLabel_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var proxy;
|
||||
var user;
|
||||
|
||||
proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false});
|
||||
user = new Clipperz.PM.DataModel.User({username:'joe', getPassphraseFunction:function () { return 'clipperz';}});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("editDirectLoginLabel_test", someTestArgs);
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['joe_clipperz_offline_copy_data']);
|
||||
deferredResult.addMethod(user, 'login');
|
||||
deferredResult.addMethod(user, 'getRecord', 'd5f700b9c3367c39551ea49e00a9ab20dae09dd79d46047b983fc7c4bfaa050d'); // YAHOO (4)
|
||||
deferredResult.addMethodcaller('directLogins');
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter('dba0db679802f0e6aa6d0b7a6aaf42350aabc5f057409edd99a268a92ebb6496'));
|
||||
deferredResult.addCallback(function (aDirectLogin) {
|
||||
var innerDeferredResult;
|
||||
var updatedLabel;
|
||||
|
||||
updatedLabel = "updated Yahoo! Mail label";
|
||||
|
||||
innerDeferredResult = new Clipperz.Async.Deferred("editDirectLoginLabel_test <inner>", someTestArgs);
|
||||
innerDeferredResult.addMethod(aDirectLogin, 'label');
|
||||
innerDeferredResult.addTest("Yahoo! Mail", "The label of the selected direct login is correct.");
|
||||
innerDeferredResult.addMethod(aDirectLogin, 'setLabel', updatedLabel);
|
||||
|
||||
innerDeferredResult.addMethod(aDirectLogin, 'label');
|
||||
innerDeferredResult.addTest(updatedLabel, "The DirectLogin returns the correct label even before committing data.");
|
||||
|
||||
innerDeferredResult.addMethod(user, 'hasPendingChanges');
|
||||
innerDeferredResult.addTest(true, "When changing the label of a DirectLogin, the user should report pending changes.");
|
||||
|
||||
//innerDeferredResult.addCallback(function () { console.log("+_+_+_+_+_+_+_+_+_+_+_+ >>>")});
|
||||
innerDeferredResult.addMethod(user, 'saveChanges');
|
||||
//innerDeferredResult.addCallback(function () { console.log("+_+_+_+_+_+_+_+_+_+_+_+ <<<")});
|
||||
innerDeferredResult.addMethod(user, 'hasPendingChanges');
|
||||
innerDeferredResult.addTest(false, "After saving changes there should be no pending changes left.");
|
||||
|
||||
innerDeferredResult.addMethod(aDirectLogin, 'label');
|
||||
innerDeferredResult.addTest(updatedLabel, "The DirectLogin returns the correct label even after committing data.");
|
||||
|
||||
innerDeferredResult.callback();
|
||||
|
||||
return innerDeferredResult;
|
||||
})
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'editDirectLoginLabel_thanResetItToThePreviousValue_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var proxy;
|
||||
var user;
|
||||
|
||||
proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false});
|
||||
user = new Clipperz.PM.DataModel.User({username:'joe', getPassphraseFunction:function () { return 'clipperz';}});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("editDirectLoginLabel_thanResetItToThePreviousValue_test", someTestArgs);
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['joe_clipperz_offline_copy_data']);
|
||||
deferredResult.addMethod(user, 'login');
|
||||
deferredResult.addMethod(user, 'getRecord', 'd5f700b9c3367c39551ea49e00a9ab20dae09dd79d46047b983fc7c4bfaa050d'); // YAHOO (4)
|
||||
deferredResult.addMethodcaller('directLogins');
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter('dba0db679802f0e6aa6d0b7a6aaf42350aabc5f057409edd99a268a92ebb6496'));
|
||||
deferredResult.addCallback(function (aDirectLogin) {
|
||||
var innerDeferredResult;
|
||||
var originalLabel;
|
||||
var updatedLabel;
|
||||
|
||||
originalLabel = "Yahoo! Mail";
|
||||
updatedLabel = "updated Yahoo! Mail label";
|
||||
|
||||
innerDeferredResult = new Clipperz.Async.Deferred("editDirectLoginLabel_thanResetItToThePreviousValue_test <inner>", someTestArgs);
|
||||
innerDeferredResult.addMethod(aDirectLogin, 'label');
|
||||
innerDeferredResult.addTest(originalLabel, "The label of the selected direct login is correct.");
|
||||
innerDeferredResult.addMethod(aDirectLogin, 'setLabel', updatedLabel);
|
||||
|
||||
innerDeferredResult.addMethod(aDirectLogin, 'label');
|
||||
innerDeferredResult.addTest(updatedLabel, "The DirectLogin returns the correct label even before committing data.");
|
||||
|
||||
innerDeferredResult.addMethod(user, 'hasPendingChanges');
|
||||
innerDeferredResult.addTest(true, "When changing the label of a DirectLogin, the user should report pending changes [2].");
|
||||
|
||||
innerDeferredResult.addMethod(aDirectLogin, 'setLabel', originalLabel);
|
||||
|
||||
innerDeferredResult.addMethod(aDirectLogin, 'hasPendingChanges');
|
||||
innerDeferredResult.addTest(false, "Restoring the original label, the directLogin should report no pending changes.");
|
||||
|
||||
innerDeferredResult.addMethod(aDirectLogin.record(), 'hasPendingChanges');
|
||||
innerDeferredResult.addTest(false, "Restoring the original label, the record should report no pending changes.");
|
||||
|
||||
innerDeferredResult.addMethod(user, 'hasPendingChanges');
|
||||
innerDeferredResult.addTest(false, "Restoring the original label, the user should report no pending changes.");
|
||||
|
||||
innerDeferredResult.callback();
|
||||
|
||||
return innerDeferredResult;
|
||||
})
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
'bindingValues_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var proxy;
|
||||
var user;
|
||||
|
||||
proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false});
|
||||
user = new Clipperz.PM.DataModel.User({username:'joe', getPassphraseFunction:function () { return 'clipperz';}});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("DirectLogin.bindingValues_test", someTestArgs);
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['joe_clipperz_offline_copy_data']);
|
||||
deferredResult.addMethod(user, 'login');
|
||||
deferredResult.addMethod(user, 'getRecord', 'd5f700b9c3367c39551ea49e00a9ab20dae09dd79d46047b983fc7c4bfaa050d'); // YAHOO (4)
|
||||
deferredResult.addMethodcaller('directLogins');
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter('dba0db679802f0e6aa6d0b7a6aaf42350aabc5f057409edd99a268a92ebb6496'));
|
||||
deferredResult.addMethodcaller('bindingValues');
|
||||
deferredResult.addCallback(function (someBindingValues) {
|
||||
SimpleTest.is(MochiKit.Base.keys(someBindingValues).length, 2, "there should be 2 bindings for this direct login");
|
||||
SimpleTest.is(someBindingValues['login'], 'joe.clipperz', "the login field should be filled with 'joe.clipperz'");
|
||||
SimpleTest.is(someBindingValues['passwd'], 'enfvDG1RxAsl', "the passwd field should be filled with 'enfvDG1RxAsl'");
|
||||
})
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
'syntaxFix': MochiKit.Base.noop
|
||||
};
|
||||
|
||||
//#############################################################################
|
||||
|
||||
SimpleTest.runDeferredTests("Clipperz.PM.DataModel.DirectLogin", tests, {trace:false});
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
|
||||
Copyright 2008-2013 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz, the online password manager.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com.
|
||||
|
||||
* Clipperz is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
* Clipperz is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Clipperz. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
*/
|
||||
|
||||
directLoginConfigurations = {
|
||||
'Yahoo! Mail': '{\n "page": {\n "title": "Yahoo! Mail"\n },\n "form": {\n "attributes": {\n "action": "https://login.yahoo.com/config/login?",\n "method": "post"\n },\n "inputs": [\n {\n "type": "hidden",\n "name": ".tries",\n "value": "1"\n },\n {\n "type": "hidden",\n "name": ".src",\n "value": "ym"\n },\n {\n "type": "hidden",\n "name": ".md5",\n "value": ""\n },\n {\n "type": "hidden",\n "name": ".hash",\n "value": ""\n },\n {\n "type": "hidden",\n "name": ".js",\n "value": ""\n },\n {\n "type": "hidden",\n "name": ".last",\n "value": ""\n },\n {\n "type": "hidden",\n "name": "promo",\n "value": ""\n },\n {\n "type": "hidden",\n "name": ".intl",\n "value": "us"\n },\n {\n "type": "hidden",\n "name": ".bypass",\n "value": ""\n },\n {\n "type": "hidden",\n "name": ".partner",\n "value": ""\n },\n {\n "type": "hidden",\n "name": ".u",\n "value": "5gp62cl2vg3ov"\n },\n {\n "type": "hidden",\n "name": ".v",\n "value": "0"\n },\n {\n "type": "hidden",\n "name": ".challenge",\n "value": "iBEY0IK6k3t9Uals32mrTos8s48p"\n },\n {\n "type": "hidden",\n "name": ".yplus",\n "value": ""\n },\n {\n "type": "hidden",\n "name": ".emailCode",\n "value": ""\n },\n {\n "type": "hidden",\n "name": "pkg",\n "value": ""\n },\n {\n "type": "hidden",\n "name": "stepid",\n "value": ""\n },\n {\n "type": "hidden",\n "name": ".ev",\n "value": ""\n },\n {\n "type": "hidden",\n "name": "hasMsgr",\n "value": "0"\n },\n {\n "type": "hidden",\n "name": ".chkP",\n "value": "Y"\n },\n {\n "type": "hidden",\n "name": ".done",\n "value": "http://mail.yahoo.com"\n },\n {\n "type": "hidden",\n "name": ".pd",\n "value": "ym_ver%3d0%26c="\n },\n {\n "type": "text",\n "name": "login",\n "value": ""\n },\n {\n "type": "password",\n "name": "passwd",\n "value": ""\n },\n {\n "type": "checkbox",\n "name": ".persistent",\n "value": "y"\n },\n {\n "type": "submit",\n "name": ".save",\n "value": "Sign In"\n }\n ]\n },\n "version": "0.2"\n}',
|
||||
'Parallels': '{"page": {"title": "Parallels Account"},\n"form": {"attributes": {"action": "https://www.parallels.com/account/",\n"method": "post"},\n"inputs": [{"type": "text",\n"name": "Email",\n"value": ""},\n{"type": "password",\n"name": "Password",\n"value": ""}]},\n"version": "0.2.3"}',
|
||||
__syntaxFix__: "syntax fix"
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2013 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz, the online password manager.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com.
|
||||
|
||||
* Clipperz is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
* Clipperz is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Clipperz. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.DataModel.EncryptedRemoteObject - test</title>
|
||||
<script>Clipperz = {}</script>
|
||||
<script type="text/javascript" src="../../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../../../SimpleTest/test.css">
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/YUI/Utils.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/ByteArray.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Logging.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Async.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Signal.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/KeyValueObjectStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/BigInt.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/AES.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/AES_2.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SHA.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/PRNG.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SRP.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Connection.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Crypto.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/EncryptedRemoteObject.js'></script>
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.Async.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id="test">
|
||||
<script type="text/javascript" src="EncryptedRemoteObject.test.js"></script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,220 @@
|
||||
/*
|
||||
|
||||
Copyright 2008-2013 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz, the online password manager.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com.
|
||||
|
||||
* Clipperz is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
* Clipperz is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Clipperz. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
*/
|
||||
|
||||
Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose();
|
||||
|
||||
var tests = {
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'simple_tests': function(someTestArgs) {
|
||||
var deferredResult;
|
||||
var encryptedRemoteObject;
|
||||
|
||||
var key;
|
||||
var version;
|
||||
var rawData;
|
||||
|
||||
key = "just a random key";
|
||||
version = Clipperz.PM.Crypto.encryptingFunctions.currentVersion;
|
||||
rawData = "just a random text to encrypt";
|
||||
|
||||
encryptedRemoteObject = new Clipperz.PM.DataModel.EncryptedRemoteObject({
|
||||
'retrieveKeyFunction': MochiKit.Base.noop,
|
||||
'retrieveRemoteDataFunction': function () { return "--"},
|
||||
'encryptedDataKeypath': '--',
|
||||
'encryptedVersionKeypath': '--'
|
||||
});
|
||||
SimpleTest.ok(encryptedRemoteObject != null, "create an encryptedRemoteObject");
|
||||
|
||||
deferredResult = Clipperz.Async.callbacks("EncryptedRemoteObject.test - simple_tests", [
|
||||
MochiKit.Base.method(encryptedRemoteObject, 'getRemoteData'),
|
||||
function(aResult) {
|
||||
SimpleTest.is(aResult, "--", "setting and getting serverData works");
|
||||
}
|
||||
], someTestArgs);
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'decrypt_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var encryptedRemoteObject;
|
||||
var key;
|
||||
var version;
|
||||
var rawData;
|
||||
|
||||
key = "just a random key";
|
||||
version = Clipperz.PM.Crypto.encryptingFunctions.currentVersion;
|
||||
rawData = "just a random text to encrypt";
|
||||
|
||||
encryptedRemoteObject = new Clipperz.PM.DataModel.EncryptedRemoteObject({
|
||||
'retrieveKeyFunction': MochiKit.Base.partial(MochiKit.Async.succeed, key),
|
||||
'retrieveRemoteDataFunction': MochiKit.Base.partial(Clipperz.Async.callbacks, "EncryptedRemoteObject.test - decrypt_test <encrypt data>", [
|
||||
MochiKit.Base.partial(Clipperz.PM.Crypto.deferredEncrypt, {key:key, value:rawData, version:version}),
|
||||
function (someEncryptedData) {
|
||||
return {
|
||||
'data': someEncryptedData,
|
||||
'version': version
|
||||
}
|
||||
}
|
||||
], someTestArgs)//,
|
||||
// 'encryptedDataKeypath': 'data',
|
||||
// 'encryptedVersionKeypath': 'version'
|
||||
});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("decrypt_test", someTestArgs);
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'getDecryptedData');
|
||||
deferredResult.addCallback(function (aResult) {
|
||||
SimpleTest.is(aResult, rawData, "encrypt and decrypt works");
|
||||
})
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'getValue_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var encryptedRemoteObject;
|
||||
var key;
|
||||
var version;
|
||||
var rawData;
|
||||
|
||||
key = "just a random key";
|
||||
version = Clipperz.PM.Crypto.encryptingFunctions.currentVersion;
|
||||
rawData = {
|
||||
key1: 'value1',
|
||||
key2: 'value2'
|
||||
};
|
||||
|
||||
encryptedRemoteObject = new Clipperz.PM.DataModel.EncryptedRemoteObject({
|
||||
'reference': "testReference",
|
||||
'retrieveKeyFunction': MochiKit.Base.partial(MochiKit.Async.succeed, key),
|
||||
'retrieveRemoteDataFunction': MochiKit.Base.partial(Clipperz.Async.callbacks, "EncryptedRemoteObject.test - decrypt_test <encrypt data>", [
|
||||
MochiKit.Base.partial(Clipperz.PM.Crypto.deferredEncrypt, {key:key, value:rawData, version:version}),
|
||||
function (someEncryptedData) {
|
||||
return {
|
||||
'data': someEncryptedData,
|
||||
'version': version
|
||||
}
|
||||
}
|
||||
], someTestArgs)//,
|
||||
// 'encryptedDataKeypath': 'data',
|
||||
// 'encryptedVersionKeypath': 'version'
|
||||
});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("decrypt_test", someTestArgs);
|
||||
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'getValue', 'key1');
|
||||
deferredResult.addTest('value1', "getting 'key1' works");
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'hasAnyCleanTextData');
|
||||
deferredResult.addTest(true, "After accessing a value, hasAnyCleanTextData returns false");
|
||||
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'hasPendingChanges');
|
||||
deferredResult.addTest(false, "if nothing has changed, the object should return not pending changes");
|
||||
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'deleteAllCleanTextData');
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'hasAnyCleanTextData');
|
||||
deferredResult.addTest(false, "After deleting all cleanTextData, hasAnyCleanTextData returns false");
|
||||
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'getValue', 'key1');
|
||||
deferredResult.addTest('value1', "getting 'key1' (also after a lock) works correctly");
|
||||
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'setValue', 'key1', 'new value1');
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'getValue', 'key1');
|
||||
deferredResult.addTest('new value1', "after setting a new value, it is correctly returned");
|
||||
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'values');
|
||||
deferredResult.addCallback(function (someValues) {
|
||||
SimpleTest.is(someValues['key1'], 'new value1', "the value got straight from the objectStore is correct");
|
||||
});
|
||||
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'hasPendingChanges');
|
||||
deferredResult.addTest(true, "once a value has been changed, the object should return that there're some pending changes");
|
||||
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'revertChanges');
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'hasPendingChanges');
|
||||
deferredResult.addTest(false, "reverting the changes should return the object to its initial state, without any peding changes");
|
||||
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'getValue', 'key1');
|
||||
deferredResult.addTest('value1', "also the value of the changed item has been restored");
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'encrypt_with_new_object_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var encryptedRemoteObject;
|
||||
var key;
|
||||
// var version;
|
||||
// var rawData;
|
||||
|
||||
key = "just a random key";
|
||||
// version = Clipperz.PM.Crypto.encryptingFunctions.currentVersion;
|
||||
// rawData = "just a random text to encrypt";
|
||||
|
||||
encryptedRemoteObject = new Clipperz.PM.DataModel.EncryptedRemoteObject({
|
||||
'retrieveRemoteDataFunction': MochiKit.Base.noop
|
||||
});
|
||||
|
||||
encryptedRemoteObject.setValue('key1', "value1");
|
||||
encryptedRemoteObject.setValue('key2', "value2");
|
||||
encryptedRemoteObject.setValue('key3', "value3");
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("encrypt_with_new_object_test", someTestArgs);
|
||||
deferredResult.addMethod(encryptedRemoteObject, 'prepareRemoteDataWithKey', key);
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter('data'));
|
||||
deferredResult.collectResults({
|
||||
'key': MochiKit.Base.partial(MochiKit.Async.succeed, key),
|
||||
'value': MochiKit.Async.succeed,
|
||||
'version': MochiKit.Base.partial(MochiKit.Async.succeed, Clipperz.PM.Crypto.encryptingFunctions.currentVersion)
|
||||
});
|
||||
deferredResult.addCallback(Clipperz.PM.Crypto.deferredDecrypt);
|
||||
deferredResult.addCallback(function (aResult) {
|
||||
SimpleTest.is(aResult['key1'], "value1", "encrypt and decrypt works for first element");
|
||||
SimpleTest.is(aResult['key2'], "value2", "encrypt and decrypt works for second element");
|
||||
SimpleTest.is(aResult['key3'], "value3", "encrypt and decrypt works for third element");
|
||||
})
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
'syntaxFix': MochiKit.Base.noop
|
||||
};
|
||||
|
||||
//#############################################################################
|
||||
|
||||
SimpleTest.runDeferredTests("Clipperz.PM.DataModel.EncryptedRemoteObject", tests, {trace:false});
|
||||
@@ -0,0 +1,99 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2013 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz, the online password manager.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com.
|
||||
|
||||
* Clipperz is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
* Clipperz is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Clipperz. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.DataModel.User - test</title>
|
||||
<script>Clipperz = {}</script>
|
||||
<script type="text/javascript" src="../../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../../../SimpleTest/test.css">
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/YUI/Utils.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Date.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/ByteArray.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Logging.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Async.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Signal.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/KeyValueObjectStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/BigInt.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/AES.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SHA.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/PRNG.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SRP.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Toll.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Offline.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Test.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Connection.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Crypto.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/UI/DirectLoginController.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings/Strings_en-US.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Date.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/EncryptedRemoteObject.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.Version.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.Version.Field.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLogin.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginInput.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginBinding.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginFormValue.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.Legacy.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.RecordIndex.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.Preferences.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/OneTimePassword.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.AccountInfo.js'></script>
|
||||
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.Async.js"></script>
|
||||
<script>
|
||||
Clipperz_IEisBroken = false;
|
||||
</script>
|
||||
|
||||
<!--[if IE]><script>
|
||||
Clipperz_IEisBroken = true;
|
||||
Clipperz_normalizedNewLine = '\x0d\x0a';
|
||||
</script><![endif]-->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id="test">
|
||||
<script>
|
||||
Clipperz.PM.Strings.Languages.setSelectedLanguage('en-us');
|
||||
</script>
|
||||
<script type="text/javascript" src="User.data.js"></script>
|
||||
<script type="text/javascript" src="OneTimePassword.test.js"></script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
|
||||
Copyright 2008-2013 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz, the online password manager.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com.
|
||||
|
||||
* Clipperz is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
* Clipperz is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Clipperz. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
*/
|
||||
|
||||
Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose();
|
||||
|
||||
var tests = {
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'isValidOneTimePasswordValue_test': function (someTestArgs) {
|
||||
var otp;
|
||||
var notOTP;
|
||||
|
||||
otp = 'yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg';
|
||||
SimpleTest.is(Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue(otp), true, "isValidOneTimePasswordValue [expect true] - test 1");
|
||||
|
||||
notOTP = 'trustno1';
|
||||
SimpleTest.is(Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue(notOTP), false, "isValidOneTimePasswordValue [expect false] - test 1");
|
||||
|
||||
return MochiKit.Async.succeed('done');
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'loginUsingOtp_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var proxy;
|
||||
var user, user2;
|
||||
var username;
|
||||
var passphrase;
|
||||
|
||||
username = "test";
|
||||
passphrase = "yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg"; // OTP
|
||||
|
||||
proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false});
|
||||
user = new Clipperz.PM.DataModel.User({username:username, getPassphraseFunction:function () { return passphrase;}});
|
||||
user2 = new Clipperz.PM.DataModel.User({username:username, getPassphraseFunction:function () { return passphrase;}});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("loginUsingOtp_test", someTestArgs);
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['test_test_with_otps']);
|
||||
|
||||
deferredResult.addMethod(user, 'login');
|
||||
deferredResult.addMethod(user, 'getRecords');
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter('length'));
|
||||
deferredResult.addTest(1, "This account has one single card");
|
||||
|
||||
deferredResult.addMethod(user, 'getOneTimePasswords');
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter('length'));
|
||||
deferredResult.addTest(1, "This account has one OTP");
|
||||
|
||||
deferredResult.addMethod(user, 'getOneTimePasswords');
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter(0));
|
||||
deferredResult.addCallback(MochiKit.Base.methodcaller('status'));
|
||||
deferredResult.addTest('USED', "The available OTP has been unsed to login, and should be marked accordingly");
|
||||
|
||||
deferredResult.addMethod(user2, 'login');
|
||||
deferredResult.shouldFail("trying to login using the same OTP twice");
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'changePassphraseAndLoginUsingOtp_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var proxy;
|
||||
var user;
|
||||
var user2;
|
||||
var user3;
|
||||
var otp;
|
||||
|
||||
otp = "yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg"; // OTP
|
||||
|
||||
newPassphrase = 'tset';
|
||||
proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false});
|
||||
user = new Clipperz.PM.DataModel.User({username:'test', getPassphraseFunction:function () { return 'test';}});
|
||||
user2 = new Clipperz.PM.DataModel.User({username:'test', getPassphraseFunction:function () { return otp;}});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("changePassphraseAndLoginUsingOtp_test", someTestArgs);
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['test_test_with_otps']);
|
||||
|
||||
deferredResult.addMethod(user, 'login');
|
||||
|
||||
deferredResult.addMethod(user, 'getRecords');
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter('length'));
|
||||
deferredResult.addTest(1, "This account has only a single card");
|
||||
|
||||
deferredResult.addMethod(user, 'changePassphrase', newPassphrase);
|
||||
deferredResult.addMethod(user, 'logout');
|
||||
|
||||
deferredResult.addMethod(user2, 'login');
|
||||
deferredResult.addMethod(user2, 'getRecords');
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter('length'));
|
||||
deferredResult.addTest(1, "This account has oly a single card");
|
||||
deferredResult.addMethod(user2, 'logout');
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'loginUsingOtpAndWrongUsername_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var proxy;
|
||||
var user, user2;
|
||||
var username;
|
||||
var wrongUsername;
|
||||
var passphrase;
|
||||
|
||||
username = "test";
|
||||
wrongUsername = "tset";
|
||||
passphrase = "yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg"; // OTP
|
||||
|
||||
proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false});
|
||||
user = new Clipperz.PM.DataModel.User({username:wrongUsername, getPassphraseFunction:function () { return passphrase;}});
|
||||
user2 = new Clipperz.PM.DataModel.User({username:username, getPassphraseFunction:function () { return passphrase;}});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("loginUsingOtpAndWrongUsername_test", someTestArgs);
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['test_test_with_otps']);
|
||||
|
||||
deferredResult.addMethod(user, 'login');
|
||||
deferredResult.shouldFail("login in using the wrong username with the OTP should fail");
|
||||
|
||||
deferredResult.addMethod(user2, 'login');
|
||||
deferredResult.shouldFail("trying to reuse the same OTP should fail, even if now it is used with the correct username");
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'loginUserWithAPassphraseLookingExactlyLikeAnOTP_test': function (someTestArgs) {
|
||||
var deferredResult;
|
||||
var proxy;
|
||||
var user;
|
||||
var username;
|
||||
var passphrase;
|
||||
|
||||
username = "otp_user";
|
||||
passphrase = "yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg"; // passphrase
|
||||
|
||||
proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false});
|
||||
user = new Clipperz.PM.DataModel.User({username:username, getPassphraseFunction:function () { return passphrase;}});
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("loginUserWithAPassphraseLookingExactlyLikeAnOTP_test", someTestArgs);
|
||||
deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['otp_user_test']);
|
||||
|
||||
deferredResult.addMethod(user, 'login');
|
||||
deferredResult.addMethod(user, 'getRecords');
|
||||
deferredResult.addCallback(MochiKit.Base.itemgetter('length'));
|
||||
deferredResult.addTest(1, "This account has one single card");
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
'syntaxFix': MochiKit.Base.noop
|
||||
};
|
||||
|
||||
|
||||
|
||||
//#############################################################################
|
||||
|
||||
SimpleTest.runDeferredTests("Clipperz.PM.DataModel.OneTimePassword", tests, {trace:false});
|
||||
94
frontend/delta/tests/tests/Clipperz/PM/DataModel/Record.html
Normal file
94
frontend/delta/tests/tests/Clipperz/PM/DataModel/Record.html
Normal file
@@ -0,0 +1,94 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2013 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz, the online password manager.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com.
|
||||
|
||||
* Clipperz is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
* Clipperz is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Clipperz. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.DataModel.Record - test</title>
|
||||
<script>Clipperz = {}</script>
|
||||
<script type="text/javascript" src="../../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../../../SimpleTest/test.css">
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/YUI/Utils.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Date.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/ByteArray.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Logging.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Async.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Signal.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Set.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/KeyValueObjectStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/BigInt.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/AES.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/AES_2.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SHA.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/PRNG.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SRP.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Toll.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings/Strings_en-US.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Date.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Offline.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Test.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Connection.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Crypto.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings/Strings_en-US.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Date.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/EncryptedRemoteObject.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.Version.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.Version.Field.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLogin.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginInput.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginBinding.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginFormValue.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.Legacy.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.RecordIndex.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.Preferences.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/OneTimePassword.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.AccountInfo.js'></script>
|
||||
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.Async.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id="test">
|
||||
<script>
|
||||
Clipperz.PM.Strings.Languages.setSelectedLanguage('en-us');
|
||||
</script>
|
||||
<script type="text/javascript" src="DirectLoginConfigurations.data.js"></script>
|
||||
<script type="text/javascript" src="User.data.js"></script>
|
||||
<script type="text/javascript" src="Record.test.js"></script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
1513
frontend/delta/tests/tests/Clipperz/PM/DataModel/Record.test.js
Normal file
1513
frontend/delta/tests/tests/Clipperz/PM/DataModel/Record.test.js
Normal file
File diff suppressed because it is too large
Load Diff
2068
frontend/delta/tests/tests/Clipperz/PM/DataModel/User.data.js
Normal file
2068
frontend/delta/tests/tests/Clipperz/PM/DataModel/User.data.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
102
frontend/delta/tests/tests/Clipperz/PM/DataModel/User.html
Normal file
102
frontend/delta/tests/tests/Clipperz/PM/DataModel/User.html
Normal file
@@ -0,0 +1,102 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2013 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz, the online password manager.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com.
|
||||
|
||||
* Clipperz is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
* Clipperz is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Clipperz. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.DataModel.User - test</title>
|
||||
<script>Clipperz = {}</script>
|
||||
<script type="text/javascript" src="../../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../../../SimpleTest/test.css">
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/YUI/Utils.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Date.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/ByteArray.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Logging.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Async.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Signal.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/KeyValueObjectStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/Base.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/BigInt.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/AES.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/AES_2.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SHA.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/PRNG.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/Crypto/SRP.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Toll.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Offline.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Test.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Connection.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Crypto.js'></script>
|
||||
|
||||
<!-- script type='text/javascript' src='../../../../../js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js'></script -->
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/UI/DirectLoginController.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Strings/Strings_en-US.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/Date.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/EncryptedRemoteObject.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.Version.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/Record.Version.Field.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLogin.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginInput.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginBinding.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/DirectLoginFormValue.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.Legacy.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.RecordIndex.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.Preferences.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/OneTimePassword.js'></script>
|
||||
<script type='text/javascript' src='../../../../../js/Clipperz/PM/DataModel/User.AccountInfo.js'></script>
|
||||
|
||||
<script type="text/javascript" src="../../../../SimpleTest/SimpleTest.Async.js"></script>
|
||||
<script>
|
||||
Clipperz_IEisBroken = false;
|
||||
</script>
|
||||
|
||||
<!--[if IE]><script>
|
||||
Clipperz_IEisBroken = true;
|
||||
Clipperz_normalizedNewLine = '\x0d\x0a';
|
||||
</script><![endif]-->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id="test">
|
||||
<script>
|
||||
Clipperz.PM.Strings.Languages.setSelectedLanguage('en-us');
|
||||
</script>
|
||||
<script type="text/javascript" src="User.data.js"></script>
|
||||
<script type="text/javascript" src="User.data.old.js"></script>
|
||||
<script type="text/javascript" src="User.test.js"></script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
2083
frontend/delta/tests/tests/Clipperz/PM/DataModel/User.test.js
Normal file
2083
frontend/delta/tests/tests/Clipperz/PM/DataModel/User.test.js
Normal file
File diff suppressed because it is too large
Load Diff
42
frontend/delta/tests/tests/Clipperz/PM/DataModel/index.html
Normal file
42
frontend/delta/tests/tests/Clipperz/PM/DataModel/index.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<!--
|
||||
|
||||
Copyright 2008-2013 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz, the online password manager.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com.
|
||||
|
||||
* Clipperz is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
* Clipperz is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Clipperz. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Clipperz.PM.DataModel.* - tests</title>
|
||||
|
||||
<script type="text/javascript" src="../../../../../js/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="../../../../SimpleTest/TestRunner.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
TestRunner.runTests(
|
||||
'DirectLogin.html',
|
||||
'EncryptedRemoteObject.html',
|
||||
'OneTimePassword.html',
|
||||
'Record.html',
|
||||
'User.html'
|
||||
);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user