diff options
| author | Jacob R. Rothenbuhler <jakerothenbuhler@gmail.com> | 2014-04-14 15:13:49 -0400 |
|---|---|---|
| committer | Simon Charette <charette.s@gmail.com> | 2014-04-14 15:55:10 -0400 |
| commit | 17c18844561431aabed89c3bd48de951db7d13ab (patch) | |
| tree | e706e99fda9117d12e89cfe66c262dd4b323ba83 /docs | |
| parent | 09af48c70fb5cc652ea109487015472e9ef984df (diff) | |
Fixed #22369 -- Added count parameter to assertTemplateUsed
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/releases/1.8.txt | 4 | ||||
| -rw-r--r-- | docs/topics/testing/tools.txt | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt index 977b166880..b206dcc4ce 100644 --- a/docs/releases/1.8.txt +++ b/docs/releases/1.8.txt @@ -154,7 +154,9 @@ Requests and Responses Tests ^^^^^ -* ... +* The ``count`` argument was added to + :meth:`~django.test.SimpleTestCase.assertTemplateUsed`. This allows you to + assert that a template was rendered a specific number of times. Validators ^^^^^^^^^^ diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt index 7bd37c63d6..2be5b8ac9f 100644 --- a/docs/topics/testing/tools.txt +++ b/docs/topics/testing/tools.txt @@ -1328,13 +1328,19 @@ your test suite. attribute ordering is not significant. See :meth:`~SimpleTestCase.assertHTMLEqual` for more details. -.. method:: SimpleTestCase.assertTemplateUsed(response, template_name, msg_prefix='') +.. method:: SimpleTestCase.assertTemplateUsed(response, template_name, msg_prefix='', count=None) Asserts that the template with the given name was used in rendering the response. The name is a string such as ``'admin/index.html'``. + .. versionadded:: 1.8 + + The count argument is an integer indicating the number of times the + template should be rendered. Default is ``None``, meaning that the + template should be rendered one or more times. + You can use this as a context manager, like this:: with self.assertTemplateUsed('index.html'): |
