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 = app.post('/', params='foobar')
>>> print(res.body) 
CONTENT_LENGTH: 6
CONTENT_TYPE: application/x-www-form-urlencoded
HTTP_HOST: localhost:80
...
wsgi.url_scheme: 'http'
wsgi.version: (1, 0)
-- Body ----------
foobar

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

You can also define the status of response :

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