Opened 13 years ago
Closed 13 years ago
#16916 closed Cleanup/optimization (fixed)
Please document django.test.Client.defaults
Reported by: | Owned by: | Raúl Cumplido | |
---|---|---|---|
Component: | Documentation | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | Raúl Cumplido | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
The documentation makes it clear that I can provide an HTTP_USER_AGENT
to the test client's methods, but it would have been nice to have it documented that the defaults exist, and how useful they are.
Attachments (1)
Change History (11)
comment:1 by , 13 years ago
Description: | modified (diff) |
---|---|
Summary: | Please document django.test.Class.defaults → Please document django.test.Client.defaults |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
comment:2 by , 13 years ago
It is partially documented -- the **extra argument is listed, and an example (using HTTP_X_REQUESTED_WITH) is provided in the API docs for the test client. However, there is certainly room for a broad guide to the topic when the Test Client is introduced.
comment:3 by , 13 years ago
Cc: | added |
---|---|
Owner: | changed from | to
comment:4 by , 13 years ago
Status: | new → assigned |
---|
comment:5 by , 13 years ago
Has patch: | set |
---|
Hi I provide a first patch but I don't understand something in the comment from aaugustin:
The values from the keywords argument to theget/post/etc. methods have precedence, then those passed in __init__, and then the defaults.
I mean defaults are passed in __init__ then your comment shouldn't be something like this:
The values from the keywords argument to the get/post/etc. methods have precedence, than those defaults passed in __init__. Or I am missing something?
comment:6 by , 13 years ago
Patch needs improvement: | set |
---|
I think lines 694-695 are too deep - the indentation should be one level of depth (see deleted lines 672-673 in your patch).
comment:7 by , 13 years ago
Patch needs improvement: | unset |
---|
Has a newer patch at github. Pull request at:
https://github.com/django/django/pull/115
comment:8 by , 13 years ago
I left a few comments on the pull request, can you update it (squashing the commits), or maybe just do a new one?
comment:10 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Defaults can also be passed in
Client.__init__
. Basically, these values just update the WSGIenviron
dictionary. There is no fixed list.The values from the keywords argument to the
get
/post
/etc. methods have precedence, then those passed in__init__
, and then the defaults.Indeed, this isn't documented.