We recently added a scripts section to our examples. We should have unit tests for these. See our tutorial unit tests for an example of how we could do this.
I really dislike the idea of duplicating these scripts in our tests so bonus points if you can figure out a way of having our tests read the docs! This might actually be a decent use of eval...
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items
0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items
0
Link issues together to show that they're related.
Learn more.
We recently added a scripts section to our examples. We should have unit tests for these. See our tutorial unit tests for an example of how we could do this.
I really dislike the idea of duplicating these scripts in our tests so bonus points if you can figure out a way of having our tests read the docs! This might actually be a decent use of eval...
What you're doing here is a hack and liable to break (... in fact, I'm a little surprised it runs right now). The get_protocolinfo_response() provides a ControlMessage like what Tor provides in reply to a PROTOCOLINFO request. You're essentially making the wrong type of object, then calling setattr() to give it an address attribute so you can use it like a RouterStatusEntry.
I just gave get_protocolinfo_response() as an example, I didn't expect you to use it directly. Take a look at what the Controller methods return, then look for corresponding types in the mock module.
I have added the rest of the tests too. Hope they are as expected.
The files changed can be seen here:
https://github.com/sammyshj/stem/pull/2/files
Please let me know what you think about the tests.