Code

Ticket #7165: assert_not_contains.diff

File assert_not_contains.diff, 1.0 KB (added by J. Pablo Fernandez <pupeno@…>, 6 years ago)
Line 
1diff --git a/django/test/testcases.py b/django/test/testcases.py
2index b0a8194..5589443 100644
3--- a/django/test/testcases.py
4+++ b/django/test/testcases.py
5@@ -128,17 +128,6 @@ class TestCase(unittest.TestCase):
6             self.failUnless(real_count != 0,
7                             "Couldn't find '%s' in response" % text)
8 
9-    def assertNotContains(self, response, text, status_code=200):
10-        """
11-        Asserts that a response indicates that a page was retrieved
12-        successfully, (i.e., the HTTP status code was as expected), and that
13-        ``text`` doesn't occurs in the content of the response.
14-        """
15-        self.assertEqual(response.status_code, status_code,
16-            "Couldn't retrieve page: Response code was %d (expected %d)'" %
17-                (response.status_code, status_code))
18-        self.assertEqual(response.content.count(text), 0)
19-
20     def assertFormError(self, response, form, field, errors):
21         """
22         Asserts that a form used to render the response has a specific field