Fork me on GitHub

WSGI Debug applicationΒΆ

webtest.debugapp.debug_app is a faker WSGI app to help to test webtest.

Examples of use :

>>> import webtest
>>> from webtest.debugapp import debug_app
>>> app = webtest.TestApp(debug_app)
>>> res ='/', params='foobar')
>>> print(res.body) 
CONTENT_TYPE: application/x-www-form-urlencoded
HTTP_HOST: localhost:80
wsgi.url_scheme: 'http'
wsgi.version: (1, 0)
-- Body ----------

Here, you can see, foobar in body when you pass foobar in params argument.

You can also define the status of response :

>>> res ='/?status=302', params='foobar')
>>> print(res.status)
302 Found

Previous topic

HTTP client/server utilities

Next topic

webtest API

This Page