Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#15876 closed Bug (fixed)

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

Reported by: slinkp 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:

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 4 years ago.
Documentation patch to make lack of middleware support explicit.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 4 years ago by jacob

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Changed 4 years ago by ShawnMilo

Documentation patch to make lack of middleware support explicit.

comment:2 Changed 4 years ago by ShawnMilo

  • Has patch set

comment:3 Changed 4 years ago by jacob

  • Triage Stage changed from Accepted to Ready for checkin

comment:4 Changed 4 years ago by ShawnMilo

  • Owner changed from nobody to ShawnMilo

comment:5 Changed 4 years ago by timo

  • Resolution set to fixed
  • Status changed from new to closed

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 Changed 4 years ago by timo

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