Django

Code

Ticket #7165: assert_not_contains.diff

File assert_not_contains.diff, 1.0 kB (added by J. Pablo Fernandez <pupeno@pupeno.com>, 7 months ago)
  • a/django/test/testcases.py

    old new  
    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