diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-08-06 16:54:17 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-08-06 16:54:17 +0000 |
| commit | 9767993a245bd465d64e7bc50d5c4b72eee5b8ef (patch) | |
| tree | 5c9b0d968e7e886f8448629ad7f02b44820c88bb /django | |
| parent | 0c37f8d81f483b6435cb591aa6b4759df763e9b9 (diff) | |
Fixed #13615 -- Clarified test assertion text to avoid confusion when response content isn't a web page. Thanks to DaNmarner for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13512 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/test/testcases.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py index 276d1f3c41..10bd6c6c9f 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -347,7 +347,7 @@ class TransactionTestCase(unittest.TestCase): def assertContains(self, response, text, count=None, status_code=200, msg_prefix=''): """ - Asserts that a response indicates that a page was retrieved + Asserts that a response indicates that some content was retrieved successfully, (i.e., the HTTP status code was as expected), and that ``text`` occurs ``count`` times in the content of the response. If ``count`` is None, the count doesn't matter - the assertion is true @@ -357,7 +357,7 @@ class TransactionTestCase(unittest.TestCase): msg_prefix += ": " self.assertEqual(response.status_code, status_code, - msg_prefix + "Couldn't retrieve page: Response code was %d" + msg_prefix + "Couldn't retrieve content: Response code was %d" " (expected %d)" % (response.status_code, status_code)) text = smart_str(text, response._charset) real_count = response.content.count(text) @@ -372,7 +372,7 @@ class TransactionTestCase(unittest.TestCase): def assertNotContains(self, response, text, status_code=200, msg_prefix=''): """ - Asserts that a response indicates that a page was retrieved + Asserts that a response indicates that some content was retrieved successfully, (i.e., the HTTP status code was as expected), and that ``text`` doesn't occurs in the content of the response. """ @@ -380,7 +380,7 @@ class TransactionTestCase(unittest.TestCase): msg_prefix += ": " self.assertEqual(response.status_code, status_code, - msg_prefix + "Couldn't retrieve page: Response code was %d" + msg_prefix + "Couldn't retrieve content: Response code was %d" " (expected %d)" % (response.status_code, status_code)) text = smart_str(text, response._charset) self.assertEqual(response.content.count(text), 0, |
