Exemplo n.º 1
0
 def fixture_response_connected(self, response_code):
     handle = MockCurl({pycurl.RESPONSE_CODE: response_code})
     handle.request_obj = Request(RequestTarget(self.host),
                                  RequestData(self.request))
     handle.output_buffer = io.BytesIO()
     handle.output_buffer.write(self.data)
     return Response.connection_successful(handle)
Exemplo n.º 2
0
 def fixture_handle(info, request, data, debug):
     handle = MockCurl(info)
     handle.request_obj = request
     handle.output_buffer = io.BytesIO()
     handle.output_buffer.write(data.encode("utf-8"))
     handle.debug_buffer = io.BytesIO()
     handle.debug_buffer.write(debug.encode("utf-8"))
     return handle
Exemplo n.º 3
0
 def fixture_response_not_connected(self, errno, error_msg):
     handle = MockCurl()
     handle.request_obj = Request(RequestTarget(self.host),
                                  RequestData(self.request))
     return Response.connection_failure(handle, errno, error_msg)