Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Clarified the text and example describing the RequestFactory. Thanks …

…to Alex for the feedback.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14192 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 98dd10e62d72f176670a206c3833f98e7c613da0 1 parent eec45e8
@freakboy3742 freakboy3742 authored
Showing with 9 additions and 7 deletions.
  1. +9 −7 docs/topics/testing.txt
View
16 docs/topics/testing.txt
@@ -1019,12 +1019,14 @@ The request factory
.. Class:: RequestFactory
-The :class:`~django.test.client.RequestFactory` is a simplified
-version of the test client that provides a way to generate a request
-instance that can be used as the first argument to any view. This
-means you can test a view function the same way as you would test any
-other function -- as a black box, with exactly known inputs, testing
-for specific outputs.
+.. versionadded:: 1.3
+
+The :class:`~django.test.client.RequestFactory` shares the same API as
+the test client. However, instead of behaving like a browser, the
+RequestFactory provides a way to generate a request instance that can
+be used as the first argument to any view. This means you can test a
+view function the same way as you would test any other function -- as
+a black box, with exactly known inputs, testing for specific outputs.
The API for the :class:`~django.test.client.RequestFactory` is a slightly
restricted subset of the test client API:
@@ -1052,7 +1054,7 @@ The following is a simple unit test using the request factory::
self.factory = RequestFactory()
def test_details(self):
- # Issue a GET request.
+ # Create a in instance of a GET request.
request = self.factory.get('/customer/details')
# Test my_view() as if it were deployed at /customer/details
Please sign in to comment.
Something went wrong with that request. Please try again.