def assertContains(self, response, text, count=None, status_code=200,
                       msg_prefix='', html=False):

        # If the response supports deferred rendering and hasn't been rendered
        # yet, then ensure that it does get rendered before proceeding further.
        if (hasattr(response, 'render') and callable(response.render)
            and not response.is_rendered):
            response.render()

        if msg_prefix:
            msg_prefix += ": "

        self.assertEqual(response.status_code, status_code,
            msg_prefix + "Couldn't retrieve content: Response code was %d"
            " (expected %d)" % (response.status_code, status_code))
        text = force_text(text, encoding=response._charset)
        if response.streaming:
            content = b''.join(response.streaming_content)
        else:
            content = response.content
        content = content.decode(response._charset)
        if html:
            content = assert_and_parse_html(self, content, None,
                "Response's content is not valid HTML:")
            text = assert_and_parse_html(self, text, None,
                "Second argument is not valid HTML:")
        real_count = content.count(text)
        if count is not None:
            self.assertEqual(real_count, count,
                msg_prefix + "Found %d instances of '%s' in response"
                " (expected %d)" % (real_count, text, count))
        else:
            self.assertTrue(real_count != 0,
                msg_prefix + "Couldn't find '%s' in response" % text)
Asserts that a response indicates that some content was retrieved
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/test/testcases.py/TransactionTestCase.assertContains