blob: 2c565a3f1b62e170638381e55b2afc48dc9562fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
======================
WSGI Debug application
======================
``webtest.debugapp.debug_app`` is a faker WSGI app to help to test *webtest*.
Examples of use :
.. code-block:: python
>>> import webtest
>>> from webtest.debugapp import debug_app
>>> app = webtest.TestApp(debug_app)
>>> res = app.post('/', params='foobar')
>>> print(res.body) # doctest: +SKIP
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
|