diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2008-11-12 11:22:05 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2008-11-12 11:22:05 +0000 |
| commit | 95d8c0619a961ebf55208bebe5cc686b8247655f (patch) | |
| tree | fc2d9d07f326db84e97f8cd6d2d25a6094a7c193 /docs/topics/testing.txt | |
| parent | a53ccc82978362aab07e4ccafb63a15fd6070e60 (diff) | |
Fixed #9351 -- Modified the test client to pass on URL encoded parameters to the underlying views. Thanks to sime for the suggestion.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9398 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/topics/testing.txt')
| -rw-r--r-- | docs/topics/testing.txt | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/docs/topics/testing.txt b/docs/topics/testing.txt index ec9ee8a014..91a78a9c33 100644 --- a/docs/topics/testing.txt +++ b/docs/topics/testing.txt @@ -493,6 +493,18 @@ arguments at time of construction: /customers/details/?name=fred&age=7 + .. versionadded:: development + + If you already have the GET arguments in URL-encoded form, you can + use that encoding instead of using the data argument. For example, + the previous GET request could also be posed as:: + + >>> c = Client() + >>> c.get('/customers/details/?name=fred&age=7') + + If you provide URL both an encoded GET data and a data argument, + the data argument will take precedence. + .. method:: Client.post(path, data={}, content_type=MULTIPART_CONTENT) Makes a POST request on the provided ``path`` and returns a @@ -544,6 +556,18 @@ arguments at time of construction: Note that you should manually close the file after it has been provided to ``post()``. + .. versionadded:: development + + If the URL you request with a POST contains encoded parameters, these + parameters will be made available in the request.GET data. For example, + if you were to make the request:: + + >>> c.post('/login/?vistor=true', {'name': 'fred', 'passwd': 'secret'}) + + ... the view handling this request could interrogate request.POST + to retrieve the username and password, and could interrogate request.GET + to determine if the user was a visitor. + .. method:: Client.head(path, data={}) .. versionadded:: development |
