commit 7b1252d6fd517b9904527c7a732a722c4a1f0cff Author: juga0 juga@riseup.net Date: Sat May 26 20:24:13 2018 +0000
Fix last_time by time and remove error_auth --- sbws/lib/v3bwfile.py | 2 +- tests/lib/data/v3bw.txt | 2 +- tests/unit/core/test_generate.py | 24 ++++++++++++------------ tests/unit/lib/test_v3bwfile.py | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/sbws/lib/v3bwfile.py b/sbws/lib/v3bwfile.py index ccb71c4..27476c6 100644 --- a/sbws/lib/v3bwfile.py +++ b/sbws/lib/v3bwfile.py @@ -33,7 +33,7 @@ BW_KEYVALUE_SEP_V110 = ' ' BW_EXTRA_ARG_KEYVALUES = ['master_key_ed25519', 'nick', 'rtt', 'time', 'success', 'error_stream', 'error_circ', 'error_misc'] -BW_KEYVALUES_INT = ['bw', 'rtt', 'success', 'error_auth', 'error_stream', +BW_KEYVALUES_INT = ['bw', 'rtt', 'success', 'error_stream', 'error_circ', 'error_misc'] BW_KEYVALUES = ['node_id', 'bw'] + BW_EXTRA_ARG_KEYVALUES
diff --git a/tests/lib/data/v3bw.txt b/tests/lib/data/v3bw.txt index 09f4a6f..4ca416f 100644 --- a/tests/lib/data/v3bw.txt +++ b/tests/lib/data/v3bw.txt @@ -7,4 +7,4 @@ latest_bandwidth=2018-04-17T14:09:07 software=sbws software_version=0.3.1-dev ==== -bw=54 error_auth=0 error_circ=0 error_misc=0 error_stream=1 last_time=2018-04-17T14:09:07 nick=A node_id=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA success=1 +bw=54 error_circ=0 error_misc=0 error_stream=1 nick=A node_id=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA rtt=456 success=1 time=2018-04-17T14:09:07 diff --git a/tests/unit/core/test_generate.py b/tests/unit/core/test_generate.py index 8ec1fee..a26ca5e 100644 --- a/tests/unit/core/test_generate.py +++ b/tests/unit/core/test_generate.py @@ -121,8 +121,8 @@ def test_generate_single_success_noscale(dotsbws_success_result, caplog, for dl in result.downloads])) rtt = median([round(r * 1000) for r in result.rtts]) bw_line = V3BWLine(result.fingerprint, bw, nick=result.nickname, rtt=rtt, - last_time=unixts_to_isodt_str(round(result.time)), - success=1, error_circ=0, error_auth=0, error_misc=0, + time=unixts_to_isodt_str(round(result.time)), + success=1, error_circ=0, error_misc=0, error_stream=0) # bw_line = V3BWLine.from_results(results) print(stdout_lines) @@ -155,8 +155,8 @@ def test_generate_single_success_scale(dotsbws_success_result, parser, bw = 7500 rtt = median([round(r * 1000) for r in result.rtts]) bw_line = V3BWLine(result.fingerprint, bw, nick=result.nickname, rtt=rtt, - last_time=unixts_to_isodt_str(round(result.time)), - success=1, error_circ=0, error_auth=0, error_misc=0, + time=unixts_to_isodt_str(round(result.time)), + success=1, error_circ=0, error_misc=0, error_stream=0) assert stdout_lines[NUM_LINES_HEADER_V110] + '\n' == str(bw_line)
@@ -193,8 +193,8 @@ def test_generate_single_relay_success_noscale( unixts_to_isodt_str(round(result.time))) bw_line = V3BWLine(result.fingerprint, speed, nick=result.nickname, rtt=rtt, - last_time=unixts_to_isodt_str(round(result.time)), - success=2, error_circ=0, error_auth=0, error_misc=0, + time=unixts_to_isodt_str(round(result.time)), + success=2, error_circ=0, error_misc=0, error_stream=0) assert stdout_lines[NUM_LINES_HEADER_V110] + '\n' == str(bw_line)
@@ -226,8 +226,8 @@ def test_generate_single_relay_success_scale( rtt = round(median([round(r * 1000) for r in result.rtts])) bw_line = V3BWLine(result.fingerprint, speed, nick=result.nickname, rtt=rtt, - last_time=unixts_to_isodt_str(round(result.time)), - success=2, error_circ=0, error_auth=0, error_misc=0, + time=unixts_to_isodt_str(round(result.time)), + success=2, error_circ=0, error_misc=0, error_stream=0) assert stdout_lines[NUM_LINES_HEADER_V110] + '\n' == str(bw_line)
@@ -265,8 +265,8 @@ def test_generate_two_relays_success_noscale( r1_rtt = round(median([round(rtt * 1000) for r in r1_results for rtt in r.rtts])) bw_line = V3BWLine(r1_fingerprint, r1_speed, nick=r1_name, rtt=r1_rtt, - last_time=r1_time, - success=2, error_circ=0, error_auth=0, error_misc=0, + time=r1_time, + success=2, error_circ=0, error_misc=0, error_stream=0) assert stdout_lines[1 + NUM_LINES_HEADER_V110] + '\n' == str(bw_line)
@@ -280,7 +280,7 @@ def test_generate_two_relays_success_noscale( r2_rtt = round(median([round(rtt * 1000) for r in r2_results for rtt in r.rtts])) bw_line = V3BWLine(r2_fingerprint, r2_speed, nick=r2_name, rtt=r2_rtt, - last_time=r2_time, - success=2, error_circ=0, error_auth=0, error_misc=0, + time=r2_time, + success=2, error_circ=0, error_misc=0, error_stream=0) assert stdout_lines[NUM_LINES_HEADER_V110] + '\n' == str(bw_line) diff --git a/tests/unit/lib/test_v3bwfile.py b/tests/unit/lib/test_v3bwfile.py index 3127a92..f6fb51b 100644 --- a/tests/unit/lib/test_v3bwfile.py +++ b/tests/unit/lib/test_v3bwfile.py @@ -34,9 +34,10 @@ header_extra_ls = [timestamp_l, version_l, software_l, software_version_l, TERMINATOR] header_extra_str = LINE_SEP.join(header_extra_ls) + LINE_SEP
-bwl_str = "bw=54 error_auth=0 error_circ=0 error_misc=0 error_stream=1 " \ - "last_time=2018-04-17T14:09:07 nick=A " \ - "node_id=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA success=1\n" +bwl_str = "bw=54 error_circ=0 error_misc=0 error_stream=1 " \ + "nick=A " \ + "node_id=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA rtt=456 success=1 " \ + "time=2018-04-17T14:09:07\n"
v3bw_str = header_extra_str + bwl_str
@@ -161,5 +162,4 @@ def test_v3bwfile(datadir, tmpdir): 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@lists.torproject.org