Opened 12 years ago

Closed 12 years ago

#16916 closed Cleanup/optimization (fixed)

Please document django.test.Client.defaults

Reported by: sailorfred@… 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 Aymeric Augustin)

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)

16916.diff (1.6 KB ) - added by Raúl Cumplido 12 years ago.
First patch

Download all attachments as: .zip

Change History (11)

comment:1 by Aymeric Augustin, 12 years ago

Description: modified (diff)
Summary: Please document django.test.Class.defaultsPlease document django.test.Client.defaults
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

Defaults can also be passed in Client.__init__. Basically, these values just update the WSGI environ dictionary. There is no fixed list.

The values from the keywords argument to theget/post/etc. methods have precedence, then those passed in __init__, and then the defaults.

Indeed, this isn't documented.

comment:2 by Russell Keith-Magee, 12 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 Raúl Cumplido, 12 years ago

Cc: Raúl Cumplido added
Owner: changed from nobody to Raúl Cumplido

comment:4 by Raúl Cumplido, 12 years ago

Status: newassigned

comment:5 by Raúl Cumplido, 12 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?

by Raúl Cumplido, 12 years ago

Attachment: 16916.diff added

First patch

comment:6 by Christopher Medrela, 12 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 anonymous, 12 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 Aymeric Augustin, 12 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 Aymeric Augustin <aymeric.augustin@…>, 12 years ago

Resolution: fixed
Status: assignedclosed

In [875c76251710c9b643a4e6164b5570713fe024f5]:

Fixed #16916 -- Documented default headers for the test client.

Thanks sailorfred AT yahoo.com for the report and raulcd
for the initial version of the patch.

Note: See TracTickets for help on using tickets.
Back to Top