summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorStéphane Klein <sklein@bearstech.com>2013-02-21 16:02:43 +0100
committerStéphane Klein <sklein@bearstech.com>2013-02-21 16:06:49 +0100
commit9694f973a2489396c4a19d5e76bb2a9650624bb2 (patch)
tree759068e189aa634bc6b9266d7d299c6d482f9de4 /docs
parent460eff9b505026ee2287f8dd7c8a6d0b744f85ab (diff)
downloadwebtest-9694f973a2489396c4a19d5e76bb2a9650624bb2.tar.gz
Append some documentation about webtest.debugapp
Diffstat (limited to 'docs')
-rw-r--r--docs/contributing.txt6
-rw-r--r--docs/debugapp.txt47
2 files changed, 52 insertions, 1 deletions
diff --git a/docs/contributing.txt b/docs/contributing.txt
index bb05939..1ca581b 100644
--- a/docs/contributing.txt
+++ b/docs/contributing.txt
@@ -71,3 +71,9 @@ Generate documentation
build succeeded, 3 warnings.
Build finished. The HTML pages are in _build/html.
+
+
+Tips
+====
+
+You can use :doc:`debugapp` object to test *webtest*.
diff --git a/docs/debugapp.txt b/docs/debugapp.txt
index 404ff2c..5765990 100644
--- a/docs/debugapp.txt
+++ b/docs/debugapp.txt
@@ -2,7 +2,52 @@
Debug application
=================
-.. automodule:: webtest.debugapp
+``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)
+ >>> app.post('/', params='foobar')
+ >>> res.body
+ CONTENT_LENGTH: 6
+ CONTENT_TYPE: application/x-www-form-urlencoded
+ HTTP_HOST: localhost:80
+ PATH_INFO: /
+ QUERY_STRING:
+ REQUEST_METHOD: POST
+ SCRIPT_NAME:
+ SERVER_NAME: localhost
+ SERVER_PORT: 80
+ SERVER_PROTOCOL: HTTP/1.0
+ paste.testing: True
+ paste.testing_variables: {}
+ paste.throw_errors: True
+ webob._parsed_query_vars: (GET([]), '')
+ wsgi.errors: <webtest.lint.ErrorWrapper object at 0x108db0f90>
+ wsgi.input: <webtest.lint.InputWrapper object at 0x108db0f50>
+ wsgi.multiprocess: False
+ wsgi.multithread: False
+ wsgi.run_once: False
+ 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 = self.app.post('/?status=302', params='foobar')
+ >>> res.status
+ '302 Found'
+
+
+Complete ``debugapp.py`` source code
+====================================
.. literalinclude:: ../webtest/debugapp.py
:pyobject: DebugApp