[tor-bugs] #6950 [pyonionoo]: write tests for pyonionoo
Tor Bug Tracker & Wiki
blackhole at torproject.org
Mon Dec 3 14:14:30 UTC 2012
#6950: write tests for pyonionoo
-----------------------+----------------------------------------------------
Reporter: gsathya | Owner: gsathya
Type: task | Status: accepted
Priority: major | Milestone:
Component: pyonionoo | Version:
Keywords: | Parent:
Points: | Actualpoints:
-----------------------+----------------------------------------------------
Comment(by karsten):
Replying to [comment:8 gsathya]:
> I've written the scaffolding code for this(will push soonish) -- stuff
like is_flag_available(flag), no_of_relays(data), is_fp_available(data),
etc.
Nice!
> I'm not sure how the tests should look though. Can you give me an
example?
On a very high-level perspective I want to test something like this: "If
you ask for all summary documents of type bridge (meaning that only
bridges are returned) and type relay (meaning that only relays are
returned), does it return neither of them as expected?" FYI, Onionoo does
not pass this test as I just found out... ;) So, in order to write this
test, I don't want to mess with the URL, nor do I want to parse any JSON.
I want to use some existing code that I tell to request summary documents,
add a "type" parameter with value "bridge" and another "type" parameter
with value "relay", and then make sure that the result contains 0 relays
and 0 bridges.
There may be lower-level tests where I want to see what happens if I pass
a parameter "tpye" with a typo in it, or where I mistakenly replace the
"=" between parameter name and value with something else, or where I write
the name of an HTTP header wrong, or where the HTTP header is entirely
messed up, or whatever. So, we need convenience methods to write short
tests, because there will be many of them, and we need the ability to
change test details on a fairly low level.
Maybe this becomes clearer once I have a set of tests ready.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/6950#comment:9>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list