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

[tor-commits] [sbws/master] Add more tests trimming results when IP changes



commit 686a5eefe1c57684deebc530445f2a8ed45f890d
Author: juga0 <juga@xxxxxxxxxx>
Date:   Wed Jun 20 07:54:12 2018 +0000

    Add more tests trimming results when IP changes
---
 tests/unit/lib/test_resultdump.py | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/tests/unit/lib/test_resultdump.py b/tests/unit/lib/test_resultdump.py
index 26794cb..13b0db8 100644
--- a/tests/unit/lib/test_resultdump.py
+++ b/tests/unit/lib/test_resultdump.py
@@ -26,12 +26,29 @@ RESULTDICT_IP_CHANGED = {FP1: [RESULTSUCCESS1, RESULTSUCCESS2]}
 RESULTDICT_IP_NOT_CHANGED = {FP1: [RESULTSUCCESS1, RESULTSUCCESS1]}
 
 
-def test_trim_results_ip_changed():
+def test_trim_results_ip_changed_defaults():
+    results_dict = trim_results_ip_changed(RESULTDICT_IP_NOT_CHANGED)
+    assert RESULTDICT_IP_NOT_CHANGED == results_dict
+
+
+def test_trim_results_ip_changed_on_changed_ipv4_changed():
     expected_results_dict = {FP1: [RESULTSUCCESS2]}
-    results_dict = trim_results_ip_changed(RESULTDICT_IP_CHANGED)
+    results_dict = trim_results_ip_changed(RESULTDICT_IP_CHANGED,
+                                           on_changed_ipv4=True)
     assert expected_results_dict == results_dict
 
 
-def test_trim_results_ip_changed_false():
-    results_dict = trim_results_ip_changed(RESULTDICT_IP_CHANGED)
+def test_trim_results_ip_changed_on_changed_ipv4_no_changed():
+    results_dict = trim_results_ip_changed(RESULTDICT_IP_NOT_CHANGED,
+                                           on_changed_ipv4=True)
+    assert RESULTDICT_IP_NOT_CHANGED == results_dict
+
+
+def test_trim_results_ip_changed_on_changed_ipv6(caplog):
+    results_dict = trim_results_ip_changed(RESULTDICT_IP_NOT_CHANGED,
+                                           on_changed_ipv6=True)
     assert RESULTDICT_IP_NOT_CHANGED == results_dict
+    for record in caplog.records:
+        assert record.levelname == 'WARNING'
+    assert 'Reseting bandwidth results when IPv6 changes, ' \
+           'is not yet implemented.\n' in caplog.text



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