Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#20237 closed Bug (fixed)

Unable to test pure binary with assertContains

Reported by: claudep 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 claudep 2 years ago.
20237-2.diff (3.3 KB) - added by claudep 2 years ago.
Also handle pure binary assertContains text param

Download all attachments as: .zip

Change History (8)

Changed 2 years ago by claudep

comment:1 Changed 2 years ago by bmispelon

  • Cc bmispelon@… added
  • Triage Stage changed from Unreviewed to Ready 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 Changed 2 years ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from new to closed

In fe01404bb9f276446fc42390242da25122f91663:

Fixed #20237 -- Reenabled assertContains with binary parameter

Thanks Baptiste Mispelon for the review.

comment:3 Changed 2 years ago by Claude Paroz <claude@…>

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 Changed 2 years ago by claudep

  • Resolution fixed deleted
  • Status changed from closed to new

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.

Changed 2 years ago by claudep

Also handle pure binary assertContains text param

comment:5 Changed 2 years ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from new to closed

In b04fd579d58332632c85ecd1ab3c7062e90086a8:

Fixed #20237 (again) Allowed binary parameter to assertContains

comment:6 Changed 2 years ago by Claude Paroz <claude@…>

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