Ticket #7165: assert_not_contains.diff

File assert_not_contains.diff, 1.0 KB (added by J. Pablo Fernandez <pupeno@…>, 17 years ago)
  • django/test/testcases.py

    diff --git a/django/test/testcases.py b/django/test/testcases.py
    index b0a8194..5589443 100644
    a b class TestCase(unittest.TestCase):  
    128128            self.failUnless(real_count != 0,
    129129                            "Couldn't find '%s' in response" % text)
    130130
    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 
    142131    def assertFormError(self, response, form, field, errors):
    143132        """
    144133        Asserts that a form used to render the response has a specific field
Back to Top