Diffstat (limited to 'frontend/gamma/tests/tests/Clipperz/RoboFormExportProcessor.html') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/tests/tests/Clipperz/RoboFormExportProcessor.html | 210 |
1 files changed, 210 insertions, 0 deletions
diff --git a/frontend/gamma/tests/tests/Clipperz/RoboFormExportProcessor.html b/frontend/gamma/tests/tests/Clipperz/RoboFormExportProcessor.html new file mode 100644 index 0000000..7fe9a84 --- a/dev/null +++ b/frontend/gamma/tests/tests/Clipperz/RoboFormExportProcessor.html @@ -0,0 +1,210 @@ +<!-- + +Copyright 2008-2011 Clipperz Srl + +This file is part of Clipperz's Javascript Crypto Library. +Javascript Crypto Library provides web developers with an extensive +and efficient set of cryptographic functions. The library aims to +obtain maximum execution speed while preserving modularity and +reusability. +For further information about its features and functionalities please +refer to http://www.clipperz.com + +* Javascript Crypto Library 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. + +* Javascript Crypto Library 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 Javascript Crypto Library. If not, see + <http://www.gnu.org/licenses/>. + +--> + +<html> +<head> + <script type="text/javascript" src="../../../js/MochiKit/MochiKit.js"></script> + <script type="text/javascript" src="../../../js/JSLog/jslog.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/Async.js'></script> + <script type='text/javascript' src='../../../js/Clipperz/KeePassExportProcessor.js'></script> + + <script type="text/javascript" src="../../SimpleTest/SimpleTest.Async.js"></script> +</head> +<body> +<pre id="test"> +<script type="text/javascript"> +try { + var deferredResult; + var keePassProcessor; + + keePassProcessor = new Clipperz.KeePassExportProcessor(); + + deferredResult = new MochiKit.Async.Deferred(); + + deferredResult.addCallback(function(aResult) { return "[Gmail]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.gmail.com\nPassword: NHy08ZCMYsqUeLQCawR7\n\n[del.icio.us]\nGroup: General\nUserName: joe69\nURL: http://del.icio.us\nPassword: tS1cIEeqp5y0wkU\n\n[Amazon]\nGroup: General\nUserName: jclipperz\nURL: http://www.amazon.com\nPassword: wvpkqNPIsqlI5g6XE9Tz\n\n[Paypal]\nGroup: General\nUserName: joeclipperz\nURL: http://www.paypal.com\nPassword: 24T4wIcvHnM28T3L\n\n[Technorati]\nGroup: General\nUserName: jclipperz\nURL: http://www.technorati.com\nPassword: UcVeNqF\n\n[American Airlines]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.aa.com\nPassword: AtrYbmi7lmSjR\n" }); + deferredResult.addCallback(MochiKit.Base.method(keePassProcessor, 'deferredParse')); + deferredResult.addCallback(function(aResult) { is(MochiKit.Base.serializeJSON(aResult), "[{\"Title\":\"Gmail\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.gmail.com\", \"Password\":\"NHy08ZCMYsqUeLQCawR7\"}, {\"Title\":\"del.icio.us\", \"Group\":\"General\", \"UserName\":\"joe69\", \"URL\":\"http://del.icio.us\", \"Password\":\"tS1cIEeqp5y0wkU\"}, {\"Title\":\"Amazon\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.amazon.com\", \"Password\":\"wvpkqNPIsqlI5g6XE9Tz\"}, {\"Title\":\"Paypal\", \"Group\":\"General\", \"UserName\":\"joeclipperz\", \"URL\":\"http://www.paypal.com\", \"Password\":\"24T4wIcvHnM28T3L\"}, {\"Title\":\"Technorati\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.technorati.com\", \"Password\":\"UcVeNqF\"}, {\"Title\":\"American Airlines\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.aa.com\", \"Password\":\"AtrYbmi7lmSjR\"}]", "first test"); }); + deferredResult.addErrback(function(anError) { is("ERROR", anError) }); + + deferredResult.addCallback(function(aResult) { return "[Gmail]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.gmail.com\nPassword: NHy08ZCMYsqUeLQCawR7\nNotes: Personal account\n\n[del.icio.us]\nGroup: General\nUserName: joe69\nURL: http://del.icio.us\nPassword: tS1cIEeqp5y0wkU\nNotes: social bookmarking site\n\n[Amazon]\nGroup: General\nUserName: jclipperz\nURL: http://www.amazon.com\nPassword: wvpkqNPIsqlI5g6XE9Tz\nNotes: The US online store\n\n[Paypal]\nGroup: General\nUserName: joeclipperz\nURL: http://www.paypal.com\nPassword: 24T4wIcvHnM28T3L\nNotes: Linked to my savings account\n\n[Technorati]\nGroup: General\nUserName: jclipperz\nURL: http://www.technorati.com\nPassword: UcVeNqF\nNotes: Blog ranking and searching\n\n[American Airlines]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.aa.com\nPassword: AtrYbmi7lmSjR\nNotes: Adavantages card n. 795495\n" }); + deferredResult.addCallback(MochiKit.Base.method(keePassProcessor, 'deferredParse')); + deferredResult.addCallback(function(aResult) { is(MochiKit.Base.serializeJSON(aResult), "[{\"Title\":\"Gmail\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.gmail.com\", \"Password\":\"NHy08ZCMYsqUeLQCawR7\", \"Notes\":\"Personal account\"}, {\"Title\":\"del.icio.us\", \"Group\":\"General\", \"UserName\":\"joe69\", \"URL\":\"http://del.icio.us\", \"Password\":\"tS1cIEeqp5y0wkU\", \"Notes\":\"social bookmarking site\"}, {\"Title\":\"Amazon\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.amazon.com\", \"Password\":\"wvpkqNPIsqlI5g6XE9Tz\", \"Notes\":\"The US online store\"}, {\"Title\":\"Paypal\", \"Group\":\"General\", \"UserName\":\"joeclipperz\", \"URL\":\"http://www.paypal.com\", \"Password\":\"24T4wIcvHnM28T3L\", \"Notes\":\"Linked to my savings account\"}, {\"Title\":\"Technorati\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.technorati.com\", \"Password\":\"UcVeNqF\", \"Notes\":\"Blog ranking and searching\"}, {\"Title\":\"American Airlines\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.aa.com\", \"Password\":\"AtrYbmi7lmSjR\", \"Notes\":\"Adavantages card n. 795495\"}]", "second test"); }); + deferredResult.addErrback(function(anError) { is("ERROR", anError) }); + + deferredResult.addCallback(function(aResult) { return "[Gmail]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.gmail.com\nPassword: NHy08ZCMYsqUeLQCawR7\nNotes: Personal account\nwith some notes stored\non multiple lines\n\n[del.icio.us]\nGroup: General\nUserName: joe69\nURL: http://del.icio.us\nPassword: tS1cIEeqp5y0wkU\nNotes: social bookmarking site\n\n[Amazon]\nGroup: General\nUserName: jclipperz\nURL: http://www.amazon.com\nPassword: wvpkqNPIsqlI5g6XE9Tz\nNotes: The US online store\n\n[Paypal]\nGroup: General\nUserName: joeclipperz\nURL: http://www.paypal.com\nPassword: 24T4wIcvHnM28T3L\nNotes: Linked to my savings account\n\n[Technorati]\nGroup: General\nUserName: jclipperz\nURL: http://www.technorati.com\nPassword: UcVeNqF\nNotes: Blog ranking and searching\n\n[American Airlines]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.aa.com\nPassword: AtrYbmi7lmSjR\nNotes: Adavantages card n. 795495\n" }); + deferredResult.addCallback(MochiKit.Base.method(keePassProcessor, 'deferredParse')); + deferredResult.addCallback(function(aResult) { is(MochiKit.Base.serializeJSON(aResult), "[{\"Title\":\"Gmail\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.gmail.com\", \"Password\":\"NHy08ZCMYsqUeLQCawR7\", \"Notes\":\"Personal account\\nwith some notes stored\\non multiple lines\\n\"}, {\"Title\":\"del.icio.us\", \"Group\":\"General\", \"UserName\":\"joe69\", \"URL\":\"http://del.icio.us\", \"Password\":\"tS1cIEeqp5y0wkU\", \"Notes\":\"social bookmarking site\"}, {\"Title\":\"Amazon\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.amazon.com\", \"Password\":\"wvpkqNPIsqlI5g6XE9Tz\", \"Notes\":\"The US online store\"}, {\"Title\":\"Paypal\", \"Group\":\"General\", \"UserName\":\"joeclipperz\", \"URL\":\"http://www.paypal.com\", \"Password\":\"24T4wIcvHnM28T3L\", \"Notes\":\"Linked to my savings account\"}, {\"Title\":\"Technorati\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.technorati.com\", \"Password\":\"UcVeNqF\", \"Notes\":\"Blog ranking and searching\"}, {\"Title\":\"American Airlines\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.aa.com\", \"Password\":\"AtrYbmi7lmSjR\", \"Notes\":\"Adavantages card n. 795495\"}]", "third test"); }); + deferredResult.addErrback(function(anError) { is("ERROR", anError) }); + + + + deferredResult.addBoth(SimpleTest.finish); + deferredResult.callback(); + +/* + var set; + var object1; + var object2; + var object3; + + set = new Clipperz.Set(); + + object1 = new Object(); + object2 = new Object(); + object3 = new Object(); + + object1.label = "object 1"; + object2.label = "object 2"; + object3.label = "object 3"; + + is(set.size(), 0, "A new set should be empty"); + + set.add(object1); + is(set.size(), 1); + is(set.contains(object1), true); + is(set.contains(object2), false); + + set.add(object1); + is(set.size(), 1, "Adding the same object twice does not change the set content"); + is(set.contains(object1), true); + is(set.contains(object2), false); + + set.add(object2); + is(set.size(), 2); + is(set.contains(object1), true); + is(set.contains(object2), true); + is(set.contains(object3), false); + + set.remove(object1); + is(set.size(), 1, "Size check after removing an object"); + is(set.contains(object1), false); + is(set.contains(object2), true); + is(set.contains(object3), false); + + set.remove(object1); + is(set.size(), 1, "Removing twice the same object does not change the set content"); + is(set.contains(object1), false); + is(set.contains(object2), true); + is(set.contains(object3), false); + + set.empty(); + is(set.size(), 0); + + { + var items; + var populatedSet; + + items = ["item1", "item2", "item3"]; + + populatedSet = new Clipperz.Set({'items': items}); + is(populatedSet.size(), 3); + is(populatedSet.contains("item1"), true); + is(populatedSet.contains("item4"), false); + + items.splice(0, items.length); + is(populatedSet.size(), 3); + } + + { + var items; + var deletedItems; + + items = ["item1", "item2", "item3"]; + + set = new Clipperz.Set({'items': items}); + deletedItems = ["item1"]; + set.remove(deletedItems); + is(set.size(), 2, "here I am"); + is(set.contains("item1"), false); + is(set.contains("item2"), true); + + set = new Clipperz.Set({'items': items}); + deletedItems = ["item1", "item2"]; + set.remove(deletedItems); + is(set.size(), 1); + is(set.contains("item1"), false); + is(set.contains("item2"), false); + + set = new Clipperz.Set({'items': items}); + deletedItems = ["item1", "item4"]; + set.remove(deletedItems); + is(set.size(), 2); + is(set.contains("item1"), false); + is(set.contains("item2"), true); + } + + { + var items; + var poppedItem; + + items = ["item1", "item2", "item3"]; + set = new Clipperz.Set({'items': items}); + + poppedItem = set.popAnItem(); + ok(poppedItem != null, "test popAnItem - 1"); + is(set.size(), 2, "test popAnItem - 2"); + + poppedItem = set.popAnItem(); + ok(poppedItem != null, "test popAnItem - 3"); + is(set.size(), 1, "test popAnItem - 4"); + + poppedItem = set.popAnItem(); + ok(poppedItem != null, "test popAnItem - 5"); + is(set.size(), 0, "test popAnItem - 6"); + + poppedItem = set.popAnItem(); + ok(poppedItem == null, "test popAnItem - 7"); + } +*/ + + 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 ); +} + +</script> +</pre> +</body> +</html> |