I think RequestFactory should be emphasized more in
https://docs.djangoproject.com/en/3.1/topics/testing/tools/. Right now,
the only mention is buried deep down on the page in a "See also" box which
links to the "Advanced testing topics". Labeling it as an "advanced"
topic is misleading. May I suggest that it should be at least briefly
covered in the introductory section. There's already a couple of
paragraphs contrasting django.test.client to Selenium. It would be good
to say something like:
A lower-level alternative to the test client is RequestFactory, which lets
you bypass the routing and middleware layers. Use RequestFactory to write
unit tests of individual view functions and methods. Use the test client
to write integration tests of how your views work in the context of your
full application. Use Selenium to test rendered HTML and the behavior of
Web pages, namely JavaScript functionality.
I'd be happy to write up an improved doc if you think this is a reasonable
way to go.
--
Ticket URL: <https://code.djangoproject.com/ticket/33026>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
Hey Roy, OK — very happy to look at a suggestion here. Thanks.
--
Ticket URL: <https://code.djangoproject.com/ticket/33026#comment:1>
* owner: nobody => Chris Wedgwood
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/33026#comment:2>
* has_patch: 0 => 1
Comment:
https://github.com/django/django/pull/16094
--
Ticket URL: <https://code.djangoproject.com/ticket/33026#comment:3>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/33026#comment:4>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/33026#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"468d06109778e3656229ac28c9019ea7246f9b79" 468d0610]:
{{{
#!CommitTicketReference repository=""
revision="468d06109778e3656229ac28c9019ea7246f9b79"
Fixed #33026 -- Mentioned RequestFactory in testing tools docs.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33026#comment:6>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"7607fc8990ec61b51d4a3baf0be51c28fa5f4605" 7607fc89]:
{{{
#!CommitTicketReference repository=""
revision="7607fc8990ec61b51d4a3baf0be51c28fa5f4605"
[4.1.x] Fixed #33026 -- Mentioned RequestFactory in testing tools docs.
Backport of 468d06109778e3656229ac28c9019ea7246f9b79 from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33026#comment:7>