Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Network Health
sbws
Commits
91d9e90f
Commit
91d9e90f
authored
Jun 19, 2018
by
juga
Browse files
Improve tests for reseting bw on IP changes
parent
59f6d608
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/unit/lib/test_resultdump.py
View file @
91d9e90f
...
...
@@ -11,10 +11,10 @@ ED25519 = 'g+Shk00y9Md0hg1S6ptnuc/wWKbADBgdjT0Kg+TSF3s'
CIRC
=
[
FP1
,
FP2
]
DEST_URL
=
'http://example.com/sbws.bin'
NICK
=
'A'
RELAY_
ip
1
=
'169.254.100.1'
RELAY_
ip
2
=
'169.254.100.2'
RELAY1
=
Result
.
Relay
(
FP1
,
NICK
,
RELAY_
ip
1
,
ED25519
)
RELAY2
=
Result
.
Relay
(
FP1
,
NICK
,
RELAY_
ip
2
,
ED25519
)
RELAY_
IP
1
=
'169.254.100.1'
RELAY_
IP
2
=
'169.254.100.2'
RELAY1
=
Result
.
Relay
(
FP1
,
NICK
,
RELAY_
IP
1
,
ED25519
)
RELAY2
=
Result
.
Relay
(
FP1
,
NICK
,
RELAY_
IP
2
,
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment