Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#20237 closed Bug (fixed)

Unable to test pure binary with assertContains

Reported by: Claude Paroz Owned by: nobody
Component: Testing framework Version: 1.5
Severity: Normal Keywords: regression
Cc: bmispelon@… 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

In one of my projects, I'm testing some readable content of a PDF file with assertContains. Unfortunately, this is no longer possible in Django 1.5 (and I'm probably partially accountable for that!), as assertContains always try to decode the response content. I'd suggest to revert this regression.

Attachments (2)

20237.diff (3.9 KB ) - added by Claude Paroz 12 years ago.
20237-2.diff (3.3 KB ) - added by Claude Paroz 12 years ago.
Also handle pure binary assertContains text param

Download all attachments as: .zip

Change History (8)

by Claude Paroz, 12 years ago

Attachment: 20237.diff added

comment:1 by Baptiste Mispelon, 12 years ago

Cc: bmispelon@… added
Triage Stage: UnreviewedReady for checkin

The patch looks good.

This does indeed appear to be a regression (the same test works fine in django 1.4).

I'm marking this as RFC.

comment:2 by Claude Paroz <claude@…>, 12 years ago

Resolution: fixed
Status: newclosed

In fe01404bb9f276446fc42390242da25122f91663:

Fixed #20237 -- Reenabled assertContains with binary parameter

Thanks Baptiste Mispelon for the review.

comment:3 by Claude Paroz <claude@…>, 12 years ago

In 427b59495e7e2a1c58a46d278f6decec1d37938c:

[1.5.x] Fixed #20237 -- Reenabled assertContains with binary parameter

Thanks Baptiste Mispelon for the review.
Backport of fe01404bb9 from master.

comment:4 by Claude Paroz, 12 years ago

Resolution: fixed
Status: closednew

Unfortunately, there is still an issue when the assertContains text parameter itself is made up of non-ascii binary content. I'll upload a complementary patch.

by Claude Paroz, 12 years ago

Attachment: 20237-2.diff added

Also handle pure binary assertContains text param

comment:5 by Claude Paroz <claude@…>, 12 years ago

Resolution: fixed
Status: newclosed

In b04fd579d58332632c85ecd1ab3c7062e90086a8:

Fixed #20237 (again) Allowed binary parameter to assertContains

comment:6 by Claude Paroz <claude@…>, 12 years ago

In abdcf818431525ec1c1165b9351cc16c5c5fa1c6:

[1.5.x] Fixed #20237 (again) Allowed binary parameter to assertContains

Backport of b04fd579d5 from master.

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