I'm trying to write a test for a Protocol
that expects a t.w.c.Response
object. I thought it would be as easy as instantiating the object with the appropriate version string, response code, phrase and t.w.c.Header
instance, but I'm not sure how to handle the last parameter, _transport
.
As far as I can tell, _transport
is where the response body will come from when Response.deliverBody
is called. Since this is precisely what my protocol must be able to handle, it seems as though I will need to fake a _transport
as well (assuming my guess as to the role of this parameter is correct).
My questions are as follows:
- What is the purpose of the
_transport
parameter? Is my understanding correct? - Assuming my intuition is correct, how can I fake a
_transport
such that I can calldeliverBody
on my dummyResponse
? - Is there perhaps a simpler way to get a dummy
Response
object?
Any additional tips and advice are welcome!