Opened 15 years ago
Closed 15 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)
Change History (6)
by , 15 years ago
| Attachment: | testcase_msg.diff added |
|---|
comment:1 by , 15 years ago
| Patch needs improvement: | set |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
Patch as written will break the tests in the regression test suite that check the exceptions that are raised by assert(Not)Contains.
comment:3 by , 15 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
comment:4 by , 15 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Replace "page" with "content" in the assertContains failure msg.