Ticket #13615: testcase_msg_r2.diff

File testcase_msg_r2.diff, 3.9 KB (added by Daniel Duan, 9 years ago)

With regression test modified.

  • django/test/testcases.py

    diff --git a/django/test/testcases.py b/django/test/testcases.py
    index 276d1f3..10bd6c6 100644
    a b class TransactionTestCase(unittest.TestCase): 
    347347    def assertContains(self, response, text, count=None, status_code=200,
    348348                       msg_prefix=''):
    349349        """
    350         Asserts that a response indicates that a page was retrieved
     350        Asserts that a response indicates that some content was retrieved
    351351        successfully, (i.e., the HTTP status code was as expected), and that
    352352        ``text`` occurs ``count`` times in the content of the response.
    353353        If ``count`` is None, the count doesn't matter - the assertion is true
    class TransactionTestCase(unittest.TestCase): 
    357357            msg_prefix += ": "
    358358
    359359        self.assertEqual(response.status_code, status_code,
    360             msg_prefix + "Couldn't retrieve page: Response code was %d"
     360            msg_prefix + "Couldn't retrieve content: Response code was %d"
    361361            " (expected %d)" % (response.status_code, status_code))
    362362        text = smart_str(text, response._charset)
    363363        real_count = response.content.count(text)
    class TransactionTestCase(unittest.TestCase): 
    372372    def assertNotContains(self, response, text, status_code=200,
    373373                          msg_prefix=''):
    374374        """
    375         Asserts that a response indicates that a page was retrieved
     375        Asserts that a response indicates that some content was retrieved
    376376        successfully, (i.e., the HTTP status code was as expected), and that
    377377        ``text`` doesn't occurs in the content of the response.
    378378        """
    class TransactionTestCase(unittest.TestCase): 
    380380            msg_prefix += ": "
    381381
    382382        self.assertEqual(response.status_code, status_code,
    383             msg_prefix + "Couldn't retrieve page: Response code was %d"
     383            msg_prefix + "Couldn't retrieve content: Response code was %d"
    384384            " (expected %d)" % (response.status_code, status_code))
    385385        text = smart_str(text, response._charset)
    386386        self.assertEqual(response.content.count(text), 0,
  • tests/regressiontests/test_client_regress/models.py

    diff --git a/tests/regressiontests/test_client_regress/models.py b/tests/regressiontests/test_client_regress/models.py
    index 6da7ae4..aca6097 100644
    a b class AssertContainsTests(TestCase): 
    3434        try:
    3535            self.assertContains(response, 'text', status_code=999)
    3636        except AssertionError, e:
    37             self.assertEquals(str(e), "Couldn't retrieve page: Response code was 200 (expected 999)")
     37            self.assertEquals(str(e), "Couldn't retrieve content: Response code was 200 (expected 999)")
    3838        try:
    3939            self.assertContains(response, 'text', status_code=999, msg_prefix='abc')
    4040        except AssertionError, e:
    41             self.assertEquals(str(e), "abc: Couldn't retrieve page: Response code was 200 (expected 999)")
     41            self.assertEquals(str(e), "abc: Couldn't retrieve content: Response code was 200 (expected 999)")
    4242
    4343        try:
    4444            self.assertNotContains(response, 'text', status_code=999)
    4545        except AssertionError, e:
    46             self.assertEquals(str(e), "Couldn't retrieve page: Response code was 200 (expected 999)")
     46            self.assertEquals(str(e), "Couldn't retrieve content: Response code was 200 (expected 999)")
    4747        try:
    4848            self.assertNotContains(response, 'text', status_code=999, msg_prefix='abc')
    4949        except AssertionError, e:
    50             self.assertEquals(str(e), "abc: Couldn't retrieve page: Response code was 200 (expected 999)")
     50            self.assertEquals(str(e), "abc: Couldn't retrieve content: Response code was 200 (expected 999)")
    5151
    5252        try:
    5353            self.assertNotContains(response, 'once')
Back to Top