[Pkg-mozext-commits] [perspectives-extension] 04/18: Unit tests - Add tests for key_weakly_seen_by_quorum()
David Prévot
taffit at alioth.debian.org
Fri Oct 25 18:24:29 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch debian
in repository perspectives-extension.
commit e2d538bb6dd7ae242c907ef4d4ae3008d9d93aef
Author: Dave Schaefer <dave.schaefer at gmail.com>
Date: Mon Oct 7 22:16:34 2013 -0600
Unit tests - Add tests for key_weakly_seen_by_quorum()
---
test/test.html | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/test/test.html b/test/test.html
index 453b192..8c29c9b 100644
--- a/test/test.html
+++ b/test/test.html
@@ -144,6 +144,32 @@ function meta_tests() {
write_string("Finished");
}
+function client_sanity() {
+ write_string("Starting client policy unit tests...");
+
+ var key = "b1:7f:b1:15:25:4e:7b:fb:93:83:ac:5c:26:df:f7:00";
+ var curtime = Pers_util.get_unix_time();
+ var short_start = curtime - 1;
+ var short_end = curtime;
+ var short_result_list = [
+ { "server" : "test1:8080",
+ "obs" : [ { "key" : key,
+ "timestamps" : [ { "start" : short_start , "end" : short_end } ] } ]
+ }
+ ];
+
+ var weakly_seen = Pers_client_policy.key_weakly_seen_by_quorum(key,
+ short_result_list, 1, -10);
+ assert((weakly_seen === false), "Negative Check lengths can't be weakly seen");
+
+ var weak_check_time_limit = Pers_util.SEC2DAY(curtime + curtime);
+ weakly_seen = Pers_client_policy.key_weakly_seen_by_quorum(key,
+ short_result_list, 1, weak_check_time_limit);
+ assert((weakly_seen === false), "Check lengths longer than time since the epoch can't be weakly seen");
+
+
+}
+
function quorum_basics() {
write_string("Starting basic quorum tests...");
@@ -487,6 +513,7 @@ function run_tests() {
clear();
meta_tests();
+ client_sanity();
quorum_basics();
quorum_oldkey();
notary_parsing();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/perspectives-extension.git
More information about the Pkg-mozext-commits
mailing list