mirror of
http://git.whoc.org.uk/git/password-manager.git
synced 2025-10-24 17:27:35 +02:00
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:
164
frontend/delta/tests/SimpleTest/SimpleTest.Async.js
Normal file
164
frontend/delta/tests/SimpleTest/SimpleTest.Async.js
Normal file
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
|
||||
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/.
|
||||
|
||||
*/
|
||||
|
||||
MochiKit.Base.update(Clipperz.Async.Deferred.prototype, {
|
||||
/*
|
||||
'_addTest': function(anExpectedValue, aDescription, isDeep, aResult) {
|
||||
if (isDeep) {
|
||||
SimpleTest.isDeeply(aResult, anExpectedValue, aDescription);
|
||||
} else {
|
||||
SimpleTest.is(aResult, anExpectedValue, aDescription);
|
||||
}
|
||||
|
||||
return aResult;
|
||||
},
|
||||
*/
|
||||
'addTest': function (anExpectedValue, aDescription, isDeep) {
|
||||
// this.addMethod(this, '_addTest', anExpectedValue, aDescription, isDeep);
|
||||
// this.addCallback(Clipperz.Async.test, anExpectedValue, aDescription, isDeep);
|
||||
|
||||
if (isDeep) {
|
||||
// SimpleTest.isDeeply(aResult, anExpectedValue, aDescription);
|
||||
this.addCallback(Clipperz.Async.Test.isDeeply(anExpectedValue, aDescription));
|
||||
} else {
|
||||
// SimpleTest.is(aResult, anExpectedValue, aDescription);
|
||||
this.addCallback(Clipperz.Async.Test.is(anExpectedValue, aDescription));
|
||||
}
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'shouldSucceed': function (aDescription) {
|
||||
this.addCallbackPass(SimpleTest.ok, true, aDescription);
|
||||
this.addErrbackPass (SimpleTest.ok, false, aDescription);
|
||||
this.addBoth(MochiKit.Async.succeed, null);
|
||||
},
|
||||
|
||||
'shouldFail': function (aDescription) {
|
||||
this.addCallbackPass(SimpleTest.ok, false, aDescription);
|
||||
this.addErrbackPass (SimpleTest.ok, true, aDescription);
|
||||
this.addBoth(MochiKit.Async.succeed, null);
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
});
|
||||
|
||||
|
||||
Clipperz.Async.Test = {};
|
||||
MochiKit.Base.update(Clipperz.Async.Test, {
|
||||
|
||||
'is': function (anExpectedResult, aDescription) {
|
||||
return MochiKit.Base.partial(function (anExpectedResult, aDescription, aResult) {
|
||||
SimpleTest.is(aResult, anExpectedResult, aDescription);
|
||||
|
||||
return aResult;
|
||||
}, anExpectedResult, aDescription);
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'ok': function (aDescription) {
|
||||
return MochiKit.Base.partial(function (aDescription, aResult) {
|
||||
SimpleTest.ok(aResult, aDescription);
|
||||
|
||||
return aResult;
|
||||
}, aDescription);
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'fail': function(aDescription) {
|
||||
return MochiKit.Base.partial(function (aDescription, aResult) {
|
||||
SimpleTest.ok(!aResult, aDescription);
|
||||
|
||||
return aResult;
|
||||
}, aDescription);
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'isDeeply': function (anExpectedResult, aDescription) {
|
||||
return MochiKit.Base.partial(function (anExpectedResult, aDescription, aResult) {
|
||||
SimpleTest.isDeeply(aResult, anExpectedResult, aDescription);
|
||||
|
||||
return aResult;
|
||||
}, anExpectedResult, aDescription);
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
__syntaxFix__: "syntax fix"
|
||||
});
|
||||
|
||||
|
||||
SimpleTest.runDeferredTests = function (aName, aTestSet, aTestArguments) {
|
||||
try {
|
||||
var deferredTests;
|
||||
var aTestName;
|
||||
var title;
|
||||
|
||||
deferredTests = new Clipperz.Async.Deferred(aName + " <deferred test set>", aTestArguments);
|
||||
|
||||
title = aName;
|
||||
|
||||
aTestName = window.location.href.match(/#.*/);
|
||||
if (aTestName && (aTestName != '#')) {
|
||||
aTestName = aTestName[0].slice(1);
|
||||
if (aTestName in aTestSet) {
|
||||
//Clipperz.log("single test execution, via fragment identifier", aTestName);
|
||||
title += ' [' + aTestName + ']';
|
||||
deferredTests.addCallback(aTestSet[aTestName], aTestArguments);
|
||||
deferredTests.addErrback(SimpleTest.ok, false, aTestName);
|
||||
} else {
|
||||
title = 'WRONG TEST NAME'
|
||||
deferredTests.addBoth(is, aTestName, null, "Wrong test name selected to run");
|
||||
}
|
||||
} else {
|
||||
for (aTestName in aTestSet) {
|
||||
deferredTests.addCallback(aTestSet[aTestName], aTestArguments);
|
||||
deferredTests.addErrback(SimpleTest.ok, false, aTestName);
|
||||
deferredTests.addBoth(MochiKit.Async.wait, 0.5);
|
||||
}
|
||||
deferredTests.addBoth(is, true, true, "FINISH: completed the full stack of tests");
|
||||
}
|
||||
|
||||
MochiKit.DOM.currentDocument().title = title;
|
||||
|
||||
deferredTests.addBoth(SimpleTest.finish);
|
||||
deferredTests.callback();
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
} catch (err) {
|
||||
var s = "test suite failure!\n";
|
||||
var o = {};
|
||||
var k = null;
|
||||
for (k in err) {
|
||||
// ensure unique keys?!
|
||||
if (!o[k]) {
|
||||
s += k + ": " + err[k] + "\n";
|
||||
o[k] = err[k];
|
||||
}
|
||||
}
|
||||
ok ( false, s );
|
||||
}
|
||||
}
|
||||
447
frontend/delta/tests/SimpleTest/SimpleTest.js
Normal file
447
frontend/delta/tests/SimpleTest/SimpleTest.js
Normal file
@@ -0,0 +1,447 @@
|
||||
/*
|
||||
|
||||
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/.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* SimpleTest, a partial Test.Simple/Test.More API compatible test library.
|
||||
*
|
||||
* Why?
|
||||
*
|
||||
* Test.Simple doesn't work on IE < 6.
|
||||
* TODO:
|
||||
* * Support the Test.Simple API used by MochiKit, to be able to test MochiKit
|
||||
* itself against IE 5.5
|
||||
*
|
||||
**/
|
||||
|
||||
if (typeof(SimpleTest) == "undefined") {
|
||||
var SimpleTest = {};
|
||||
}
|
||||
|
||||
// Check to see if the TestRunner is present and has logging
|
||||
if (typeof(parent) != "undefined" && parent.TestRunner) {
|
||||
SimpleTest._logEnabled = parent.TestRunner.logEnabled;
|
||||
}
|
||||
|
||||
SimpleTest._tests = [];
|
||||
SimpleTest._stopOnLoad = true;
|
||||
SimpleTest._scopeCopy = {};
|
||||
|
||||
/**
|
||||
* Saves a copy of the specified scope variables.
|
||||
*/
|
||||
SimpleTest.saveScope = function (scope) {
|
||||
SimpleTest._scopeCopy = {};
|
||||
for (var k in scope) {
|
||||
SimpleTest._scopeCopy[k] = scope[k];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies the specified scope against the stored copy and reports
|
||||
* any differences as test failures.
|
||||
*/
|
||||
SimpleTest.verifyScope = function (scope) {
|
||||
var filter = ['test', '_firebug','_FirebugConsole','XMLHttpRequest','Audio',
|
||||
'XSLTProcessor','Option','Image','scrollMaxX','scrollMaxY',
|
||||
'clipboardData'];
|
||||
for (var k in scope) {
|
||||
if (MochiKit.Base.findValue(filter, k) < 0) {
|
||||
var v = scope[k];
|
||||
var old = SimpleTest._scopeCopy[k];
|
||||
if (v !== old && typeof(old) === "undefined") {
|
||||
SimpleTest.ok(false, "scope modified, variable " + k + " was added");
|
||||
} else if (v !== old) {
|
||||
SimpleTest.ok(false, "scope modified, variable " + k + " changed from: " + old + ", to: " + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var k in SimpleTest._scopeCopy) {
|
||||
if (!(k in scope)) {
|
||||
SimpleTest.ok(false, "scope modified, variable " + k + " has been removed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Something like assert.
|
||||
*/
|
||||
SimpleTest.ok = function (condition, name, diag) {
|
||||
var test = {'result': !!condition, 'name': name, 'diag': diag || ""};
|
||||
if (SimpleTest._logEnabled) {
|
||||
var msg = test.result ? "PASS" : "FAIL";
|
||||
msg += " | " + test.name;
|
||||
if (test.result) {
|
||||
parent.TestRunner.logger.log(msg);
|
||||
} else {
|
||||
msg += " | " + test.diag;
|
||||
parent.TestRunner.logger.error(msg);
|
||||
}
|
||||
}
|
||||
SimpleTest._tests.push(test);
|
||||
};
|
||||
|
||||
/**
|
||||
* Roughly equivalent to ok(a==b, name)
|
||||
*/
|
||||
SimpleTest.is = function (a, b, name) {
|
||||
var repr = MochiKit.Base.repr;
|
||||
SimpleTest.ok(a == b, name, "got " + repr(a) + ", expected " + repr(b));
|
||||
};
|
||||
|
||||
/**
|
||||
* Roughly equivalent to ok(compare(a,b)==0, name)
|
||||
*/
|
||||
SimpleTest.eq = function (a, b, name) {
|
||||
var base = MochiKit.Base;
|
||||
var repr = base.repr;
|
||||
try {
|
||||
SimpleTest.ok(base.compare(a, b) == 0, name, "got " + repr(a) + ", expected " + repr(b));
|
||||
} catch (e) {
|
||||
SimpleTest.ok(false, name, "exception in compare: " + repr(e));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Makes a test report, returns it as a DIV element.
|
||||
**/
|
||||
SimpleTest.report = function () {
|
||||
var DIV = MochiKit.DOM.DIV;
|
||||
var passed = 0;
|
||||
var failed = 0;
|
||||
var results = MochiKit.Base.map(
|
||||
function (test) {
|
||||
var cls, msg;
|
||||
if (test.result) {
|
||||
passed++;
|
||||
cls = "test_ok";
|
||||
msg = "ok - " + test.name;
|
||||
} else {
|
||||
failed++;
|
||||
cls = "test_not_ok";
|
||||
msg = "not ok - " + test.name;
|
||||
if (test.diag != null && test.diag != "") {
|
||||
msg += ": " + test.diag;
|
||||
}
|
||||
}
|
||||
return DIV({"class": cls}, msg);
|
||||
},
|
||||
SimpleTest._tests
|
||||
);
|
||||
var summary_class = ((failed == 0) ? 'all_pass' : 'some_fail');
|
||||
return DIV({'class': 'tests_report'},
|
||||
DIV({'class': 'tests_summary ' + summary_class},
|
||||
DIV({'class': 'tests_passed'}, "Passed: " + passed),
|
||||
DIV({'class': 'tests_failed'}, "Failed: " + failed)),
|
||||
results
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Toggle element visibility
|
||||
**/
|
||||
SimpleTest.toggle = function(el) {
|
||||
if (MochiKit.Style.getStyle(el, 'display') == 'block') {
|
||||
el.style.display = 'none';
|
||||
} else {
|
||||
el.style.display = 'block';
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Toggle visibility for divs with a specific class.
|
||||
**/
|
||||
SimpleTest.toggleByClass = function (cls) {
|
||||
var elems = MochiKit.DOM.getElementsByTagAndClassName('div', cls);
|
||||
MochiKit.Base.map(SimpleTest.toggle, elems);
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Shows the report in the browser
|
||||
**/
|
||||
|
||||
SimpleTest.showReport = function() {
|
||||
var base = MochiKit.Base;
|
||||
var dom = MochiKit.DOM;
|
||||
var togglePassed = dom.A({'href': '#'}, "Toggle passed tests");
|
||||
var toggleFailed = dom.A({'href': '#'}, "Toggle failed tests");
|
||||
togglePassed.onclick = base.partial(SimpleTest.toggleByClass, 'test_ok');
|
||||
toggleFailed.onclick = base.partial(SimpleTest.toggleByClass, 'test_not_ok');
|
||||
var body = document.getElementsByTagName("body")[0];
|
||||
var firstChild = body.childNodes[0];
|
||||
var addNode;
|
||||
if (firstChild) {
|
||||
addNode = function (el) {
|
||||
body.insertBefore(el, firstChild);
|
||||
};
|
||||
} else {
|
||||
addNode = function (el) {
|
||||
body.appendChild(el)
|
||||
};
|
||||
}
|
||||
addNode(togglePassed);
|
||||
addNode(dom.SPAN(null, " "));
|
||||
addNode(toggleFailed);
|
||||
addNode(SimpleTest.report());
|
||||
};
|
||||
|
||||
/**
|
||||
* Tells SimpleTest to don't finish the test when the document is loaded,
|
||||
* useful for asynchronous tests.
|
||||
*
|
||||
* When SimpleTest.waitForExplicitFinish is called,
|
||||
* explicit SimpleTest.finish() is required.
|
||||
**/
|
||||
SimpleTest.waitForExplicitFinish = function () {
|
||||
SimpleTest._stopOnLoad = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Talks to the TestRunner if being ran on a iframe and the parent has a
|
||||
* TestRunner object.
|
||||
**/
|
||||
SimpleTest.talkToRunner = function () {
|
||||
if (typeof(parent) != "undefined" && parent.TestRunner) {
|
||||
parent.TestRunner.testFinished(document);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Finishes the tests. This is automatically called, except when
|
||||
* SimpleTest.waitForExplicitFinish() has been invoked.
|
||||
**/
|
||||
SimpleTest.finish = function () {
|
||||
SimpleTest.showReport();
|
||||
SimpleTest.talkToRunner();
|
||||
};
|
||||
|
||||
|
||||
MochiKit.DOM.addLoadEvent(function() {
|
||||
if (SimpleTest._stopOnLoad) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
});
|
||||
|
||||
// --------------- Test.Builder/Test.More isDeeply() -----------------
|
||||
|
||||
|
||||
SimpleTest.DNE = {dne: 'Does not exist'};
|
||||
SimpleTest.LF = "\r\n";
|
||||
SimpleTest._isRef = function (object) {
|
||||
var type = typeof(object);
|
||||
return type == 'object' || type == 'function';
|
||||
};
|
||||
|
||||
|
||||
SimpleTest._deepCheck = function (e1, e2, stack, seen) {
|
||||
var ok = false;
|
||||
// Either they're both references or both not.
|
||||
var sameRef = !(!SimpleTest._isRef(e1) ^ !SimpleTest._isRef(e2));
|
||||
if (e1 == null && e2 == null) {
|
||||
ok = true;
|
||||
} else if (e1 != null ^ e2 != null) {
|
||||
ok = false;
|
||||
} else if (e1 == SimpleTest.DNE ^ e2 == SimpleTest.DNE) {
|
||||
ok = false;
|
||||
} else if (sameRef && e1 == e2) {
|
||||
// Handles primitives and any variables that reference the same
|
||||
// object, including functions.
|
||||
ok = true;
|
||||
} else if (SimpleTest.isa(e1, 'Array') && SimpleTest.isa(e2, 'Array')) {
|
||||
ok = SimpleTest._eqArray(e1, e2, stack, seen);
|
||||
} else if (typeof e1 == "object" && typeof e2 == "object") {
|
||||
ok = SimpleTest._eqAssoc(e1, e2, stack, seen);
|
||||
} else {
|
||||
// If we get here, they're not the same (function references must
|
||||
// always simply rererence the same function).
|
||||
stack.push({ vals: [e1, e2] });
|
||||
ok = false;
|
||||
}
|
||||
return ok;
|
||||
};
|
||||
|
||||
SimpleTest._eqArray = function (a1, a2, stack, seen) {
|
||||
// Return if they're the same object.
|
||||
if (a1 == a2) return true;
|
||||
|
||||
// JavaScript objects have no unique identifiers, so we have to store
|
||||
// references to them all in an array, and then compare the references
|
||||
// directly. It's slow, but probably won't be much of an issue in
|
||||
// practice. Start by making a local copy of the array to as to avoid
|
||||
// confusing a reference seen more than once (such as [a, a]) for a
|
||||
// circular reference.
|
||||
for (var j = 0; j < seen.length; j++) {
|
||||
if (seen[j][0] == a1) {
|
||||
return seen[j][1] == a2;
|
||||
}
|
||||
}
|
||||
|
||||
// If we get here, we haven't seen a1 before, so store it with reference
|
||||
// to a2.
|
||||
seen.push([ a1, a2 ]);
|
||||
|
||||
var ok = true;
|
||||
// Only examines enumerable attributes. Only works for numeric arrays!
|
||||
// Associative arrays return 0. So call _eqAssoc() for them, instead.
|
||||
var max = a1.length > a2.length ? a1.length : a2.length;
|
||||
if (max == 0) return SimpleTest._eqAssoc(a1, a2, stack, seen);
|
||||
for (var i = 0; i < max; i++) {
|
||||
var e1 = i > a1.length - 1 ? SimpleTest.DNE : a1[i];
|
||||
var e2 = i > a2.length - 1 ? SimpleTest.DNE : a2[i];
|
||||
stack.push({ type: 'Array', idx: i, vals: [e1, e2] });
|
||||
if (ok = SimpleTest._deepCheck(e1, e2, stack, seen)) {
|
||||
stack.pop();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
};
|
||||
|
||||
SimpleTest._eqAssoc = function (o1, o2, stack, seen) {
|
||||
// Return if they're the same object.
|
||||
if (o1 == o2) return true;
|
||||
|
||||
// JavaScript objects have no unique identifiers, so we have to store
|
||||
// references to them all in an array, and then compare the references
|
||||
// directly. It's slow, but probably won't be much of an issue in
|
||||
// practice. Start by making a local copy of the array to as to avoid
|
||||
// confusing a reference seen more than once (such as [a, a]) for a
|
||||
// circular reference.
|
||||
seen = seen.slice(0);
|
||||
for (var j = 0; j < seen.length; j++) {
|
||||
if (seen[j][0] == o1) {
|
||||
return seen[j][1] == o2;
|
||||
}
|
||||
}
|
||||
|
||||
// If we get here, we haven't seen o1 before, so store it with reference
|
||||
// to o2.
|
||||
seen.push([ o1, o2 ]);
|
||||
|
||||
// They should be of the same class.
|
||||
|
||||
var ok = true;
|
||||
// Only examines enumerable attributes.
|
||||
var o1Size = 0; for (var i in o1) o1Size++;
|
||||
var o2Size = 0; for (var i in o2) o2Size++;
|
||||
var bigger = o1Size > o2Size ? o1 : o2;
|
||||
for (var i in bigger) {
|
||||
var e1 = o1[i] == undefined ? SimpleTest.DNE : o1[i];
|
||||
var e2 = o2[i] == undefined ? SimpleTest.DNE : o2[i];
|
||||
stack.push({ type: 'Object', idx: i, vals: [e1, e2] });
|
||||
if (ok = SimpleTest._deepCheck(e1, e2, stack, seen)) {
|
||||
stack.pop();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
};
|
||||
|
||||
SimpleTest._formatStack = function (stack) {
|
||||
var variable = '$Foo';
|
||||
for (var i = 0; i < stack.length; i++) {
|
||||
var entry = stack[i];
|
||||
var type = entry['type'];
|
||||
var idx = entry['idx'];
|
||||
if (idx != null) {
|
||||
if (/^\d+$/.test(idx)) {
|
||||
// Numeric array index.
|
||||
variable += '[' + idx + ']';
|
||||
} else {
|
||||
// Associative array index.
|
||||
idx = idx.replace("'", "\\'");
|
||||
variable += "['" + idx + "']";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var vals = stack[stack.length-1]['vals'].slice(0, 2);
|
||||
var vars = [
|
||||
variable.replace('$Foo', 'got'),
|
||||
variable.replace('$Foo', 'expected')
|
||||
];
|
||||
|
||||
var out = "Structures begin differing at:" + SimpleTest.LF;
|
||||
for (var i = 0; i < vals.length; i++) {
|
||||
var val = vals[i];
|
||||
if (val == null) {
|
||||
val = 'undefined';
|
||||
} else {
|
||||
val == SimpleTest.DNE ? "Does not exist" : "'" + val + "'";
|
||||
}
|
||||
}
|
||||
|
||||
out += vars[0] + ' = ' + vals[0] + SimpleTest.LF;
|
||||
out += vars[1] + ' = ' + vals[1] + SimpleTest.LF;
|
||||
|
||||
return ' ' + out;
|
||||
};
|
||||
|
||||
|
||||
SimpleTest.isDeeply = function (it, as, name) {
|
||||
var ok;
|
||||
// ^ is the XOR operator.
|
||||
if (SimpleTest._isRef(it) ^ SimpleTest._isRef(as)) {
|
||||
// One's a reference, one isn't.
|
||||
ok = false;
|
||||
} else if (!SimpleTest._isRef(it) && !SimpleTest._isRef(as)) {
|
||||
// Neither is an object.
|
||||
ok = SimpleTest.is(it, as, name);
|
||||
} else {
|
||||
// We have two objects. Do a deep comparison.
|
||||
var stack = [], seen = [];
|
||||
if ( SimpleTest._deepCheck(it, as, stack, seen)) {
|
||||
ok = SimpleTest.ok(true, name);
|
||||
} else {
|
||||
ok = SimpleTest.ok(false, name, SimpleTest._formatStack(stack));
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
};
|
||||
|
||||
SimpleTest.typeOf = function (object) {
|
||||
var c = Object.prototype.toString.apply(object);
|
||||
var name = c.substring(8, c.length - 1);
|
||||
if (name != 'Object') return name;
|
||||
// It may be a non-core class. Try to extract the class name from
|
||||
// the constructor function. This may not work in all implementations.
|
||||
if (/function ([^(\s]+)/.test(Function.toString.call(object.constructor))) {
|
||||
return RegExp.$1;
|
||||
}
|
||||
// No idea. :-(
|
||||
return name;
|
||||
};
|
||||
|
||||
SimpleTest.isa = function (object, clas) {
|
||||
return SimpleTest.typeOf(object) == clas;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Global symbols:
|
||||
var ok = SimpleTest.ok;
|
||||
var is = SimpleTest.is;
|
||||
var isDeeply = SimpleTest.isDeeply;
|
||||
256
frontend/delta/tests/SimpleTest/TestRunner.js
Normal file
256
frontend/delta/tests/SimpleTest/TestRunner.js
Normal file
@@ -0,0 +1,256 @@
|
||||
/*
|
||||
|
||||
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/.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* TestRunner: A test runner for SimpleTest
|
||||
* TODO:
|
||||
*
|
||||
* * Avoid moving iframes: That causes reloads on mozilla and opera.
|
||||
*
|
||||
*
|
||||
**/
|
||||
var TestRunner = {};
|
||||
TestRunner.logEnabled = false;
|
||||
TestRunner._iframes = {};
|
||||
TestRunner._iframeDocuments = {};
|
||||
TestRunner._iframeRows = {};
|
||||
TestRunner._currentTest = 0;
|
||||
TestRunner._urls = [];
|
||||
TestRunner._testsDiv = DIV();
|
||||
TestRunner._progressDiv = DIV();
|
||||
TestRunner._summaryDiv = DIV(null,
|
||||
H1(null, "Tests Summary"),
|
||||
TABLE(null,
|
||||
THEAD(null,
|
||||
TR(null,
|
||||
TH(null, "Test"),
|
||||
TH(null, "Passed"),
|
||||
TH(null, "Failed")
|
||||
)
|
||||
),
|
||||
TFOOT(/*null, TR(null, TH(null, "-"), TH(null, "--"), TH(null, "---"))*/),
|
||||
TBODY()
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* This function is called after generating the summary.
|
||||
**/
|
||||
TestRunner.onComplete = null;
|
||||
|
||||
/**
|
||||
* If logEnabled is true, this is the logger that will be used.
|
||||
**/
|
||||
TestRunner.logger = MochiKit.Logging.logger;
|
||||
|
||||
/**
|
||||
* Toggle element visibility
|
||||
**/
|
||||
TestRunner._toggle = function(el) {
|
||||
if (el.className == "noshow") {
|
||||
el.className = "";
|
||||
el.style.cssText = "";
|
||||
} else {
|
||||
el.className = "noshow";
|
||||
el.style.cssText = "width:0px; height:0px; border:0px;";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates the iframe that contains a test
|
||||
**/
|
||||
TestRunner._makeIframe = function (url) {
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.src = url;
|
||||
iframe.name = url;
|
||||
iframe.width = "500";
|
||||
var tbody = TestRunner._summaryDiv.getElementsByTagName("tbody")[0];
|
||||
var tr = TR(null, TD({'colspan': '3'}, iframe));
|
||||
iframe._row = tr;
|
||||
tbody.appendChild(tr);
|
||||
return iframe;
|
||||
};
|
||||
|
||||
/**
|
||||
* TestRunner entry point.
|
||||
*
|
||||
* The arguments are the URLs of the test to be ran.
|
||||
*
|
||||
**/
|
||||
TestRunner.runTests = function (/*url...*/) {
|
||||
if (TestRunner.logEnabled)
|
||||
TestRunner.logger.log("SimpleTest START");
|
||||
|
||||
var body = document.getElementsByTagName("body")[0];
|
||||
appendChildNodes(body,
|
||||
TestRunner._testsDiv,
|
||||
TestRunner._progressDiv,
|
||||
TestRunner._summaryDiv
|
||||
);
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
TestRunner._urls.push(arguments[i]);
|
||||
}
|
||||
|
||||
TestRunner.runNextTest();
|
||||
};
|
||||
|
||||
/**
|
||||
* Run the next test. If no test remains, calls makeSummary
|
||||
**/
|
||||
TestRunner.runNextTest = function() {
|
||||
if (TestRunner._currentTest < TestRunner._urls.length) {
|
||||
var url = TestRunner._urls[TestRunner._currentTest];
|
||||
var progress = SPAN(null,
|
||||
"Running ", A({href:url}, url), "..."
|
||||
);
|
||||
|
||||
if (TestRunner.logEnabled)
|
||||
TestRunner.logger.log(scrapeText(progress));
|
||||
|
||||
TestRunner._progressDiv.appendChild(progress);
|
||||
TestRunner._iframes[url] = TestRunner._makeIframe(url);
|
||||
} else {
|
||||
TestRunner.makeSummary();
|
||||
if (TestRunner.onComplete) {
|
||||
TestRunner.onComplete();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This stub is called by SimpleTest when a test is finished.
|
||||
**/
|
||||
TestRunner.testFinished = function (doc) {
|
||||
appendChildNodes(TestRunner._progressDiv, SPAN(null, "Done"), BR());
|
||||
var finishedURL = TestRunner._urls[TestRunner._currentTest];
|
||||
|
||||
if (TestRunner.logEnabled)
|
||||
TestRunner.logger.debug("SimpleTest finished " + finishedURL);
|
||||
|
||||
TestRunner._iframeDocuments[finishedURL] = doc;
|
||||
// TestRunner._iframes[finishedURL].style.display = "none";
|
||||
if (finishedURL != null) {
|
||||
TestRunner._toggle(TestRunner._iframes[finishedURL]);
|
||||
TestRunner._currentTest++;
|
||||
TestRunner.runNextTest();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Display the summary in the browser
|
||||
**/
|
||||
/*
|
||||
TestRunner.makeSummary = function() {
|
||||
if (TestRunner.logEnabled)
|
||||
TestRunner.logger.log("SimpleTest FINISHED");
|
||||
var rows = [];
|
||||
for (var url in TestRunner._iframeDocuments) {
|
||||
var doc = TestRunner._iframeDocuments[url];
|
||||
var nOK = withDocument(doc,
|
||||
partial(getElementsByTagAndClassName, 'div', 'test_ok')
|
||||
).length;
|
||||
var nNotOK = withDocument(doc,
|
||||
partial(getElementsByTagAndClassName, 'div', 'test_not_ok')
|
||||
).length;
|
||||
var toggle = partial(TestRunner._toggle, TestRunner._iframes[url]);
|
||||
var jsurl = "TestRunner._toggle(TestRunner._iframes['" + url + "'])";
|
||||
var row = TR(
|
||||
{'style': {'backgroundColor': nNotOK > 0 ? "#f00":"#0f0"}},
|
||||
TD(null, url),
|
||||
TD(null, nOK),
|
||||
TD(null, nNotOK)
|
||||
);
|
||||
row.onclick = toggle;
|
||||
var tbody = TestRunner._summaryDiv.getElementsByTagName("tbody")[0];
|
||||
tbody.insertBefore(row, TestRunner._iframes[url]._row)
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
TestRunner.makeSummary = function() {
|
||||
var base = MochiKit.Base;
|
||||
var dom = MochiKit.DOM;
|
||||
var iter = MochiKit.Iter;
|
||||
var total_Ok, total_not_Ok;
|
||||
|
||||
total_Ok = 0;
|
||||
total_not_Ok = 0;
|
||||
|
||||
if (TestRunner.logEnabled)
|
||||
TestRunner.logger.log("SimpleTest FINISHED");
|
||||
var rows = [];
|
||||
for (var url in TestRunner._iframeDocuments) {
|
||||
var doc = TestRunner._iframeDocuments[url];
|
||||
var nOK = withDocument(doc,
|
||||
partial(getElementsByTagAndClassName, 'div', 'test_ok')
|
||||
).length;
|
||||
var nNotOK = withDocument(doc,
|
||||
partial(getElementsByTagAndClassName, 'div', 'test_not_ok')
|
||||
).length;
|
||||
var toggle = partial(TestRunner._toggle, TestRunner._iframes[url]);
|
||||
var jsurl = "TestRunner._toggle(TestRunner._iframes['" + url + "'])";
|
||||
var row = TR(
|
||||
{'style': {'backgroundColor': nNotOK > 0 ? "#f00":"#0f0"}},
|
||||
TD(null, url),
|
||||
TD(null, nOK),
|
||||
TD(null, nNotOK)
|
||||
);
|
||||
row.onclick = toggle;
|
||||
var tbody = TestRunner._summaryDiv.getElementsByTagName("tbody")[0];
|
||||
tbody.insertBefore(row, TestRunner._iframes[url]._row);
|
||||
|
||||
total_Ok += nOK;
|
||||
total_not_Ok += nNotOK;
|
||||
}
|
||||
|
||||
{
|
||||
var tfoot = TestRunner._summaryDiv.getElementsByTagName("tfoot")[0];
|
||||
tfoot.appendChild(TR(null,
|
||||
TH(null, ""),
|
||||
TH({'style':"color:green;"}, total_Ok),
|
||||
TH({'style':"color:" + ((total_not_Ok == 0) ? 'black' : 'red') + ";"}, total_not_Ok)
|
||||
));
|
||||
}
|
||||
|
||||
var testRunnerResults;
|
||||
var i, c;
|
||||
|
||||
testRunnerResults = dom.DIV({'style': 'display:none; visibility:hidden;'}, null);
|
||||
|
||||
c = total_Ok;
|
||||
for (i=0; i<c; i++) {
|
||||
dom.appendChildNodes(testRunnerResults, dom.DIV({'class': 'test_ok'}, "ok"));
|
||||
}
|
||||
|
||||
c = total_not_Ok;
|
||||
for (i=0; i<c; i++) {
|
||||
dom.appendChildNodes(testRunnerResults, dom.DIV({'class': 'test_not_ok'}, "fail"));
|
||||
}
|
||||
|
||||
document.getElementsByTagName("body")[0].appendChild(testRunnerResults);
|
||||
|
||||
if (typeof(parent) != "undefined" && parent.TestRunner) {
|
||||
parent.TestRunner.testFinished(document);
|
||||
}
|
||||
};
|
||||
51
frontend/delta/tests/SimpleTest/test.css
Normal file
51
frontend/delta/tests/SimpleTest/test.css
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
|
||||
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/.
|
||||
|
||||
*/
|
||||
|
||||
.test_ok {
|
||||
color: green;
|
||||
display: none;
|
||||
}
|
||||
.test_not_ok {
|
||||
color: red;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.test_ok, .test_not_ok {
|
||||
border-bottom-width: 2px;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-color: black;
|
||||
}
|
||||
|
||||
.all_pass {
|
||||
background-color: lime;
|
||||
}
|
||||
|
||||
.some_fail {
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
.tests_report {
|
||||
border-width: 2px;
|
||||
border-style: solid;
|
||||
width: 20em;
|
||||
}
|
||||
@@ -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