Changeset 7578
- Timestamp:
- 06/06/08 08:50:02 (4 months ago)
- Files:
-
- django/trunk/AUTHORS (modified) (1 diff)
- django/trunk/django/test/testcases.py (modified) (1 diff)
- django/trunk/docs/testing.txt (modified) (3 diffs)
- django/trunk/tests/regressiontests/test_client_regress/models.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/AUTHORS
r7565 r7578 143 143 Stefane Fermgier <sf@fermigier.com> 144 144 Afonso Fernández Nogueira <fonzzo.django@gmail.com> 145 J. Pablo Fernandez <pupeno@pupeno.com> 145 146 Matthew Flanagan <http://wadofstuff.blogspot.com> 146 147 Eric Floehr <eric@intellovations.com> django/trunk/django/test/testcases.py
r7056 r7578 128 128 self.failUnless(real_count != 0, 129 129 "Couldn't find '%s' in response" % text) 130 131 def assertNotContains(self, response, text, status_code=200): 132 """ 133 Asserts that a response indicates that a page was retrieved 134 successfully, (i.e., the HTTP status code was as expected), and that 135 ``text`` doesn't occurs in the content of the response. 136 """ 137 self.assertEqual(response.status_code, status_code, 138 "Couldn't retrieve page: Response code was %d (expected %d)'" % 139 (response.status_code, status_code)) 140 self.assertEqual(response.content.count(text), 0, 141 "Response should not contain '%s'" % text) 130 142 131 143 def assertFormError(self, response, form, field, errors): django/trunk/docs/testing.txt
r7368 r7578 823 823 provided, ``text`` must occur exactly ``count`` times in the response. 824 824 825 ``assertNotContains(response, text, status_code=200)`` 826 Asserts that a ``Response`` instance produced the given ``status_code`` and 827 that ``text`` does not appears in the content of the response. 828 825 829 ``assertFormError(response, form, field, errors)`` 826 830 Asserts that a field on a form raises the provided list of errors when … … 837 841 ``errors`` is an error string, or a list of error strings, that are 838 842 expected as a result of form validation. 843 844 ``assertTemplateUsed(response, template_name)`` 845 Asserts that the template with the given name was used in rendering the 846 response. 847 848 The name is a string such as ``'admin/index.html'``. 839 849 840 850 ``assertTemplateNotUsed(response, template_name)`` … … 846 856 it redirected to ``expected_url`` (including any GET data), and the subsequent 847 857 page was received with ``target_status_code``. 848 849 ``assertTemplateUsed(response, template_name)``850 Asserts that the template with the given name was used in rendering the851 response.852 853 The name is a string such as ``'admin/index.html'``.854 858 855 859 E-mail services django/trunk/tests/regressiontests/test_client_regress/models.py
r7330 r7578 12 12 response = self.client.get('/test_client_regress/no_template_view/') 13 13 14 self.assertNotContains(response, 'never') 14 15 self.assertContains(response, 'never', 0) 15 16 self.assertContains(response, 'once') … … 19 20 20 21 try: 22 self.assertNotContains(response, 'once') 23 except AssertionError, e: 24 self.assertEquals(str(e), "Response should not contain 'once'") 25 26 try: 21 27 self.assertContains(response, 'never', 1) 22 28 except AssertionError, e:
