[Pkg-mozext-commits] [perspectives-extension] 13/22: Unit tests - Fix tests for key_weakly_seen_by_quorum()

David Prévot taffit at moszumanska.debian.org
Mon May 12 17:17:43 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch debian
in repository perspectives-extension.

commit 6ca863ad43730b3f13b40dcc8978635b302ae139
Author: Dave Schaefer <dave.schaefer at gmail.com>
Date:   Mon May 5 22:15:21 2014 -0600

    Unit tests - Fix tests for key_weakly_seen_by_quorum()
    
    Update the tests -
    the data sets used for these tests actually *are* weakly seen -
    the key has been seen by at least one notary in the past X days.
    These tests were incorrect before, as was the function.
    
    The important part - that results with and without gaps are identical -
    remains the same.
---
 test/test.html | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/test/test.html b/test/test.html
index d4d4bf6..7d0dd43 100644
--- a/test/test.html
+++ b/test/test.html
@@ -456,7 +456,7 @@ function quorum_basics() {
  var weak_check_time_limit = Pers_util.SEC2DAY(Pers_util.get_unix_time() - end_time_2);
  var gap_weakly_seen1 = Pers_client_policy.key_weakly_seen_by_quorum(key,
           gap_result_list, 1, weak_check_time_limit);
- assert((gap_weakly_seen1 === false), "key is not 'weakly seen'");
+ assert((gap_weakly_seen1 === true), "key is 'weakly seen'");
 
   assert(end_time_2 > (cur_time - max_stale_sec), "Gap setup: New target key2 ends inside the cutoff limit");
   var gap_quorum_duration2 = Pers_client_policy.get_quorum_duration(key2,
@@ -467,7 +467,7 @@ function quorum_basics() {
 
    var gap_weakly_seen2 = Pers_client_policy.key_weakly_seen_by_quorum(key2,
           gap_result_list, 1, weak_check_time_limit);
- assert((gap_weakly_seen2 === false), "key2 is not 'weakly seen'");
+ assert((gap_weakly_seen2 === true), "key2 is 'weakly seen'");
 
   // if we had the same result set without the gap, the durations should be the same
  spacer("Gap and non-gap durations should be the same");
@@ -506,7 +506,8 @@ function quorum_basics() {
    var weak_check_time_limit = Pers_util.SEC2DAY(Pers_util.get_unix_time() - end_time_2);
    var nongap_weakly_seen1 = Pers_client_policy.key_weakly_seen_by_quorum(key,
             non_gap_result_list, 1, weak_check_time_limit);
-   assert((nongap_weakly_seen1 === false), "key is not 'weakly seen'");
+   assert((nongap_weakly_seen1 === true), "key is 'weakly seen'");
+   // the important tests - that results with and without gaps are the same.
    assert((nongap_weakly_seen1 === gap_weakly_seen1), "'weakly seen' result is the same with and without gaps.");
 
   assert(end_time_2 > (cur_time - max_stale_sec), "Nongap setup: New target key2 ends inside the cutoff limit");
@@ -521,7 +522,7 @@ function quorum_basics() {
    // so allow a check length going back to the end date of the observation.
    var nongap_weakly_seen2 = Pers_client_policy.key_weakly_seen_by_quorum(key2,
             non_gap_result_list, 1, weak_check_time_limit);
-   assert((nongap_weakly_seen2 === false), "key is not 'weakly seen'");
+   assert((nongap_weakly_seen2 === true), "key is 'weakly seen'");
    assert((nongap_weakly_seen2 === gap_weakly_seen2), "'weakly seen' result is the same with and without gaps.");
 
   spacer("Further gap tests");

-- 
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