Opened 15 years ago

Closed 14 years ago

#13615 closed (fixed)

test.TestCase.assert(Not)Contains assumes response content is a page.

Reported by: Daniel Duan Owned by: nobody
Component: Testing framework Version: dev
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently, if a test fails on django.TestCase.assertContains/assertNotContains(), Django says "Couldn't retrieve page: Response code was %d", which is an odd message if someone expects the response content is not a web page.

It took me about 2 minutes to comprehend this message the first time when I was working on a webapp that speaks JSON.

The message should use the word "content" instead of "page", it does make a difference.

Attachments (2)

testcase_msg.diff (2.1 KB ) - added by Daniel Duan 15 years ago.
Replace "page" with "content" in the assertContains failure msg.
testcase_msg_r2.diff (3.9 KB ) - added by Daniel Duan 14 years ago.
With regression test modified.

Download all attachments as: .zip

Change History (6)

by Daniel Duan, 15 years ago

Attachment: testcase_msg.diff added

Replace "page" with "content" in the assertContains failure msg.

comment:1 by Russell Keith-Magee, 14 years ago

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

Patch as written will break the tests in the regression test suite that check the exceptions that are raised by assert(Not)Contains.

comment:2 by Daniel Duan, 14 years ago

Patch needs improvement: unset

Here, now its fixed

by Daniel Duan, 14 years ago

Attachment: testcase_msg_r2.diff added

With regression test modified.

comment:3 by Russell Keith-Magee, 14 years ago

Triage Stage: AcceptedReady for checkin

comment:4 by Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: newclosed

(In [13512]) Fixed #13615 -- Clarified test assertion text to avoid confusion when response content isn't a web page. Thanks to DaNmarner for the report and patch.

Note: See TracTickets for help on using tickets.
Back to Top