summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorGael Pasgrimaud <gael@gawel.org>2013-01-29 16:58:47 +0100
committerGael Pasgrimaud <gael@gawel.org>2013-01-29 16:58:47 +0100
commit6e2aa7fafb18c143da5d1a7398e9e20a6bb8a746 (patch)
tree0bef47c72cdc268f7d95157d24fe2dc51ea588d0 /docs
parent2bc0c2d41ff2354bfd89cb09780471042a6758bd (diff)
downloadwebtest-6e2aa7fafb18c143da5d1a7398e9e20a6bb8a746.tar.gz
add test for patch_json
Diffstat (limited to 'docs')
-rw-r--r--docs/json.txt17
-rw-r--r--docs/json_fixt.py4
2 files changed, 16 insertions, 5 deletions
diff --git a/docs/json.txt b/docs/json.txt
index 285a67f..1cc2d54 100644
--- a/docs/json.txt
+++ b/docs/json.txt
@@ -42,6 +42,19 @@ PUT
>>> print(resp.json)
{u'id': 1, u'value': u'new value'}
+PATCH
+======
+
+.. code-block:: python
+
+ >>> resp = app.patch_json('/resource/1/', dict(value='value'))
+ >>> print(resp.request)
+ PATCH /resource/1/ HTTP/1.0
+ ...
+
+ >>> print(resp.json)
+ {u'id': 1, u'value': u'value'}
+
GET
===
@@ -53,7 +66,5 @@ GET
...
>>> print(resp.json)
- {u'id': 1, u'value': u'new value'}
-
-
+ {u'id': 1, u'value': u'value'}
diff --git a/docs/json_fixt.py b/docs/json_fixt.py
index a67551e..4463151 100644
--- a/docs/json_fixt.py
+++ b/docs/json_fixt.py
@@ -12,8 +12,8 @@ import json
def app(environ, start_response):
req = Request(environ)
resp = Response(content_type='application/json')
- if req.method == 'GET':
- resp.body = json.dumps(dict(id=1, value='new value'))
+ if req.method in ('GET', 'PATCH'):
+ resp.body = json.dumps(dict(id=1, value='value'))
else:
resp.body = req.body
return resp(environ, start_response)