[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [sbws/master] Fix tests missing ed25519 and wrong Result version



commit d3f21849ca7224c73d485ad9df826503e568f45b
Author: juga0 <juga@xxxxxxxxxx>
Date:   Mon Jun 11 10:05:08 2018 +0000

    Fix tests missing ed25519 and wrong Result version
---
 tests/unit/lib/data/results.txt |  4 ++--
 tests/unit/lib/test_v3bwfile.py | 18 ++++++++----------
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/tests/unit/lib/data/results.txt b/tests/unit/lib/data/results.txt
index 33dacf4..ecf0b68 100644
--- a/tests/unit/lib/data/results.txt
+++ b/tests/unit/lib/data/results.txt
@@ -1,2 +1,2 @@
-{"version": 2, "time": 1523887747, "circ": ["AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"], "type": "success", "rtts": [0.4596822261810303, 0.44872617721557617, 0.4563450813293457, 0.44872212409973145, 0.4561030864715576, 0.4765200614929199, 0.4495084285736084, 0.45711588859558105, 0.45520496368408203, 0.4635589122772217], "fingerprint": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "scanner": "IDidntEditTheSBWSConfig", "downloads": [{"amount": 590009, "duration": 6.1014368534088135}, {"amount": 590009, "duration": 8.391342878341675}, {"amount": 321663, "duration": 7.064587831497192}, {"amount": 321663, "duration": 8.266003131866455}, {"amount": 321663, "duration": 5.779450178146362}], "dest_url": "http://y.z";, "nickname": "A", "address": "111.111.111.111", "ed25519_master_key": "g+Shk00y9Md0hg1S6ptnuc/wWKbADBgdjT0Kg+TSF3s"}
-{"version": 2, "time": 1523974147, "circ": ["AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"], "type": "error-stream", "msg": "Something bad happened while measuring bandwidth", "fingerprint": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "scanner": "IDidntEditTheSBWSConfig", "dest_url": "http://y.z";, "nickname": "A", "address": "111.111.111.111", "ed25519_master_key": "g+Shk00y9Md0hg1S6ptnuc/wWKbADBgdjT0Kg+TSF3s"}
+{"version": 3, "time": 1523887747, "circ": ["AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"], "type": "success", "rtts": [0.4596822261810303, 0.44872617721557617, 0.4563450813293457, 0.44872212409973145, 0.4561030864715576, 0.4765200614929199, 0.4495084285736084, 0.45711588859558105, 0.45520496368408203, 0.4635589122772217], "fingerprint": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "scanner": "IDidntEditTheSBWSConfig", "downloads": [{"amount": 590009, "duration": 6.1014368534088135}, {"amount": 590009, "duration": 8.391342878341675}, {"amount": 321663, "duration": 7.064587831497192}, {"amount": 321663, "duration": 8.266003131866455}, {"amount": 321663, "duration": 5.779450178146362}], "dest_url": "http://y.z";, "nickname": "A", "address": "111.111.111.111", "ed25519_master_key": "g+Shk00y9Md0hg1S6ptnuc/wWKbADBgdjT0Kg+TSF3s"}
+{"version": 3, "time": 1523974147, "circ": ["AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"], "type": "error-stream", "msg": "Something bad happened while measuring bandwidth", "fingerprint": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "scanner": "IDidntEditTheSBWSConfig", "dest_url": "http://y.z";, "nickname": "A", "address": "111.111.111.111", "ed25519_master_key": "g+Shk00y9Md0hg1S6ptnuc/wWKbADBgdjT0Kg+TSF3s"}
diff --git a/tests/unit/lib/test_v3bwfile.py b/tests/unit/lib/test_v3bwfile.py
index b54ea39..b61c303 100644
--- a/tests/unit/lib/test_v3bwfile.py
+++ b/tests/unit/lib/test_v3bwfile.py
@@ -1,10 +1,9 @@
 # -*- coding: utf-8 -*-
 """Test generation of bandwidth measurements document (v3bw)"""
 import json
-import pytest
 
 from sbws import __version__ as version
-from sbws.globals import SPEC_VERSION
+from sbws.globals import SPEC_VERSION, RESULT_VERSION
 from sbws.lib.resultdump import Result, load_result_file
 from sbws.lib.v3bwfile import (V3BwHeader, V3BWLine, TERMINATOR, LINE_SEP,
                                KEYVALUE_SEP_V110, num_results_of_type,
@@ -36,6 +35,7 @@ header_extra_ls = [timestamp_l, version_l,
 header_extra_str = LINE_SEP.join(header_extra_ls) + LINE_SEP
 
 bwl_str = "bw=54 error_circ=0 error_misc=0 error_stream=1 " \
+    "master_key_ed25519=g+Shk00y9Md0hg1S6ptnuc/wWKbADBgdjT0Kg+TSF3s " \
     "nick=A " \
     "node_id=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA rtt=456 success=1 " \
     "time=2018-04-17T14:09:07\n"
@@ -49,11 +49,12 @@ RESULT_ERROR_STREAM_DICT = {
     "time": 1526894062.6408398,
     "circ": ["AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
              "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"],
-    "version": 2,
+    "version": RESULT_VERSION,
     "scanner": "IDidntEditTheSBWSConfig",
     "type": "error-stream",
     "msg": "Something bad happened while measuring bandwidth",
-    "nickname": "A"
+    "nickname": "A",
+    "ed25519_master_key": "g+Shk00y9Md0hg1S6ptnuc/wWKbADBgdjT0Kg+TSF3s"
 }
 
 RESULT_SUCCESS_DICT = {
@@ -67,7 +68,7 @@ RESULT_SUCCESS_DICT = {
              0.4635589122772217],
     "circ": ["AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
              "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"],
-    "version": 2,
+    "version": RESULT_VERSION,
     "scanner": "IDidntEditTheSBWSConfig",
     "type": "success",
     "downloads": [
@@ -76,7 +77,8 @@ RESULT_SUCCESS_DICT = {
         {"amount": 321663, "duration": 7.064587831497192},
         {"amount": 321663, "duration": 8.266003131866455},
         {"amount": 321663, "duration": 5.779450178146362}],
-    "nickname": "A"
+    "nickname": "A",
+    "ed25519_master_key": "g+Shk00y9Md0hg1S6ptnuc/wWKbADBgdjT0Kg+TSF3s"
 }
 RESULT_SUCCESS_STR = str(RESULT_SUCCESS_DICT)
 RESULT_ERROR_STREAM_STR = str(RESULT_ERROR_STREAM_DICT)
@@ -128,7 +130,6 @@ def test_v3bwheader_from_file(datadir):
     assert str(h) == str(header)
 
 
-@pytest.mark.skip(reason="FIXME results")
 def test_num_results_of_type():
     assert num_results_of_type([Result.from_dict(RESULT_SUCCESS_DICT)],
                                'success') == 1
@@ -140,7 +141,6 @@ def test_num_results_of_type():
                                'error-stream') == 1
 
 
-@pytest.mark.skip(reason="FIXME results")
 def test_v3bwline_from_results_file(datadir):
     lines = datadir.readlines('results.txt')
     d = dict()
@@ -154,7 +154,6 @@ def test_v3bwline_from_results_file(datadir):
     assert bwl_str == str(bwl)
 
 
-@pytest.mark.skip(reason="FIXME results")
 def test_v3bwfile(datadir, tmpdir):
     """Test generate v3bw file (including relay_lines)."""
     v3bw = datadir.read('v3bw.txt')
@@ -165,5 +164,4 @@ def test_v3bwfile(datadir, tmpdir):
                         earliest_bandwidth=earliest_bandwidth)
     bwls = [V3BWLine.from_results(results[fp]) for fp in results]
     f = V3BwFile(header, bwls)
-    # f = V3BwFile.from_results(None, str(tmpdir.join("v3bw.txt")), results)
     assert v3bw == str(f)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits