Commit 91d9e90f authored by juga's avatar juga
Browse files

Improve tests for reseting bw on IP changes

parent 59f6d608
......@@ -11,10 +11,10 @@ ED25519 = 'g+Shk00y9Md0hg1S6ptnuc/wWKbADBgdjT0Kg+TSF3s'
CIRC = [FP1, FP2]
DEST_URL = 'http://example.com/sbws.bin'
NICK = 'A'
RELAY_ip1 = '169.254.100.1'
RELAY_ip2 = '169.254.100.2'
RELAY1 = Result.Relay(FP1, NICK, RELAY_ip1, ED25519)
RELAY2 = Result.Relay(FP1, NICK, RELAY_ip2, ED25519)
RELAY_IP1 = '169.254.100.1'
RELAY_IP2 = '169.254.100.2'
RELAY1 = Result.Relay(FP1, NICK, RELAY_IP1, ED25519)
RELAY2 = Result.Relay(FP1, NICK, RELAY_IP2, ED25519)
RTTS = [5, 25]
DOWNLOADS = [{'duration': 4, 'amount': 40}]
......@@ -22,10 +22,16 @@ RESULTSUCCESS1 = ResultSuccess(RTTS, DOWNLOADS, RELAY1, CIRC, DEST_URL,
'sbws', t=TIME1)
RESULTSUCCESS2 = ResultSuccess(RTTS, DOWNLOADS, RELAY2, CIRC, DEST_URL,
'sbws', t=TIME2)
RESULTDICT = {FP1: [RESULTSUCCESS1, RESULTSUCCESS2]}
RESULTDICT_IP_CHANGED = {FP1: [RESULTSUCCESS1, RESULTSUCCESS2]}
RESULTDICT_IP_NOT_CHANGED = {FP1: [RESULTSUCCESS1, RESULTSUCCESS1]}
def test_trim_results_ip_changed():
expected_results_dict = {FP1: [RESULTSUCCESS2]}
results_dict = trim_results_ip_changed(RESULTDICT)
results_dict = trim_results_ip_changed(RESULTDICT_IP_CHANGED)
assert expected_results_dict == results_dict
def test_trim_results_ip_changed_false():
results_dict = trim_results_ip_changed(RESULTDICT_IP_CHANGED)
assert RESULTDICT_IP_NOT_CHANGED == results_dict
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment