diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-10-12 23:55:38 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-10-12 23:55:38 +0000 |
| commit | 98dd10e62d72f176670a206c3833f98e7c613da0 (patch) | |
| tree | c2ee64dc3e56656a7966578ab7f69ac96d5a1782 /docs | |
| parent | eec45e8b710b97201db106a6460fe051f8917833 (diff) | |
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
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/testing.txt | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/docs/topics/testing.txt b/docs/topics/testing.txt index efd2593b71..d3a4fcf57a 100644 --- a/docs/topics/testing.txt +++ b/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 |
