Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#15876 closed Bug (fixed)

Document that test.client.RequestFactory doesn't support sessions or request-altering middleware

Reported by: Paul Winkler Owned by: ShawnMilo
Component: Documentation Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Since #15736 has been closed "wontfix", I think it could be classified as a documentation problem:
the RequestFactory docs at
http://docs.djangoproject.com/en/dev/topics/testing/#the-request-factory
make it sound like RequestFactory().get() creates a request that is equivalent to that used by TestClient.get().
But this is not true - TestClient goes out of its way to handle django.contrib.session, and loads middleware; RequestFactory does neither - and based on the response to #15736 that's by design.

So that should be explicit in the docs.

Attachments (1)

15876.diff (527 bytes ) - added by ShawnMilo 13 years ago.
Documentation patch to make lack of middleware support explicit.

Download all attachments as: .zip

Change History (7)

comment:1 by Jacob, 13 years ago

Triage Stage: UnreviewedAccepted

by ShawnMilo, 13 years ago

Attachment: 15876.diff added

Documentation patch to make lack of middleware support explicit.

comment:2 by ShawnMilo, 13 years ago

Has patch: set

comment:3 by Jacob, 13 years ago

Triage Stage: AcceptedReady for checkin

comment:4 by ShawnMilo, 13 years ago

Owner: changed from nobody to ShawnMilo

comment:5 by Tim Graham, 13 years ago

Resolution: fixed
Status: newclosed

In [16128]:

Fixed #15876 - Document that test.client.RequestFactory doesn't support sessions or request-altering middleware; thanks slinkp for the suggestion, ShawnMilo for the patch.

comment:6 by Tim Graham, 13 years ago

In [16129]:

[1.3.X] Fixed #15876 - Document that test.client.RequestFactory doesn't support sessions or request-altering middleware; thanks slinkp for the suggestion, ShawnMilo for the patch.

Backport of r16128 from trunk.

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