Code

Opened 13 months ago

Closed 12 months ago

Last modified 12 months 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 13 months ago.
20237-2.diff (3.3 KB) - added by claudep 12 months ago.
Also handle pure binary assertContains text param

Download all attachments as: .zip

Change History (8)

Changed 13 months ago by claudep

comment:1 Changed 13 months 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 12 months 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 12 months 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 12 months 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 12 months ago by claudep

Also handle pure binary assertContains text param

comment:5 Changed 12 months 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 12 months ago by Claude Paroz <claude@…>

In abdcf818431525ec1c1165b9351cc16c5c5fa1c6:

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

Backport of b04fd579d5 from master.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.