Document that test.client.RequestFactory doesn't support sessions or request-altering middleware
|Reported by:||Paul Winkler||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.