Hi,

Recently I worked on refactoring a project so that it was, in my opinion, more 
testable. For reference, the diff is available at 
<https://github.com/Weasyl/txyam/compare/Weasyl:9230b7d09c1413a09d776700f26a01865aa99604...cdf7aef9e3425f27016f8e97c59bd2143fbf805c>,
 and the important parts in the changed version are at 
<https://github.com/Weasyl/txyam/blob/cdf7aef9e3425f27016f8e97c59bd2143fbf805c/txyam/client.py#L24-L49>.
 

My question: is this a good factoring for testing a wrapper? It seems to make 
sense to split apart crafting and issuing requests to clients, as it lets you 
test the contents of a request to see what will happen instead of having to 
issue the request and test that its effects happened.

On a previous iteration of this project, I wrote tests that did exactly that: 
issued requests and checked the bytes that were sent to a StringTransport. 
Those tests ended up being harder to read and write, and seemed to rely on the 
exact implementation of the thing I was wrapping.

Thanks in advance for any feedback on the matter,
~weykent


_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to