Should probably consider changing it to kwargs, but this way it is explicit about what args are being dropped. Add a note to the docs to indicate this is the case (it's always been true).
36 lines
920 B
ReStructuredText
36 lines
920 B
ReStructuredText
httplib2_intercept
|
|
==================
|
|
|
|
.. automodule:: wsgi_intercept.httplib2_intercept
|
|
|
|
.. note:: No effort is made to pass SSL certificate or version
|
|
information to the the underlying ``HTTPSConnection``. The
|
|
assumption is that wsgi-intercept is testing the behavior
|
|
of the application, not the connection.
|
|
|
|
Example:
|
|
|
|
.. testcode::
|
|
|
|
import httplib2
|
|
from wsgi_intercept import httplib2_intercept, add_wsgi_intercept
|
|
|
|
|
|
def app(environ, start_response):
|
|
start_response('200 OK', [('Content-Type', 'text/plain')])
|
|
return [b'Whee']
|
|
|
|
|
|
def make_app():
|
|
return app
|
|
|
|
|
|
host, port = 'localhost', 80
|
|
url = 'http://{0}:{1}/'.format(host, port)
|
|
httplib2_intercept.install()
|
|
add_wsgi_intercept(host, port, make_app)
|
|
http = httplib2.Http()
|
|
resp, content = http.request(url)
|
|
assert content == b'Whee'
|
|
httplib2_intercept.uninstall()
|