Document that test.client.RequestFactory doesn't support sessions or request-altering middleware
|Reported by:||slinkp||Owned by:||ShawnMilo|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Since #15736 has been closed "wontfix", I think it could be classified as a documentation problem:
the RequestFactory docs at
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.
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