meejah / txtorcon

Twisted-based asynchronous Tor control protocol implementation. Includes unit-tests, examples, state-tracking code and configuration abstraction.
http://fjblvrw2jrxnhtg67qpbzi45r7ofojaoo3orzykesly2j3c2m3htapid.onion/
MIT License
250 stars 72 forks source link

Added descriptor get_info() test #118

Closed sambuddhabasu closed 9 years ago

sambuddhabasu commented 9 years ago

Added the descriptor get_info() test. The test presently fails and work needs to be done on the parse_keywords() and get_info() method for the test to pass. This will be reflected in the next commits.

sambuddhabasu commented 9 years ago

@meejah In commit https://github.com/sammyshj/txtorcon/commit/f9d771fa3fa1bc24e39358e56e1d4b957bc751d4, I have added a basic parse_get_info() method. This method now handles both single line and multiline responses. However, the the method is still in initial stage and hence, the tests fail. Let me know what you think about this and whether we should move forward with this. Thanks

sambuddhabasu commented 9 years ago

@meejah When the https://github.com/meejah/txtorcon/blob/master/test/test_torcontrolprotocol.py#L430 test is run, should the response be a\nb\nc, or the current response mentioned that is \na\nb\nc?

meejah commented 9 years ago

I think there should be a leading newline like the test says... why?

sambuddhabasu commented 9 years ago

Okay I need to make necessary changes to the test https://github.com/sammyshj/txtorcon/commit/711ed48acc2f60e4595452115d039479bcd1d7b9#diff-87729881434e634ea8b65a976a61f2efR608 then

sambuddhabasu commented 9 years ago

@meejah In commit https://github.com/sammyshj/txtorcon/commit/95d8557b5dc72b19b513d29c89da8192e99d3a37, the parsing is now done by first splitting the lines based on the newline character and then forming the dict by looking if the key is present in the passed arguments. Now only one test fails, https://github.com/meejah/txtorcon/blob/master/test/test_torcontrolprotocol.py#L578 This is because we pass the argument as FOO however when the parsing is done, it finds the key as a which is not in the passed arguments and hence it fails. It expects the response to be, 250-FOO=oneLet me know what should be done about this test. Thanks

meejah commented 9 years ago

Yeah broken test; change it to ask for "a" or answer with "FOO", whichever. Thanks! I'll look at the rest in a little while...

sambuddhabasu commented 9 years ago

@meejah Fixed the test. Now, all the tests pass on Travis CI. Let me know if the code looks good to be merged and I will go ahead and squash all the commits into one.

sambuddhabasu commented 9 years ago

@meejah Squashed all the commits. The PR can be merged now :)