[Django] #29520: Posting bytes broken in 2.1 TestClient

32 views
Skip to first unread message

Django

unread,
Jun 23, 2018, 7:31:10 AM6/23/18
to django-...@googlegroups.com
#29520: Posting bytes broken in 2.1 TestClient
---------------------------------------------+------------------------
Reporter: Mathias Ertl | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 2.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------------+------------------------
b8a41a2872624a6d9e61308932dd81d001e31eb9 removes the `force_bytes` method
for encoding data in post requests with `data.encode()`. This breaks the
usecase of posting `data=bytes` to `TestClient.post()`, since that type
does not have that function. The old implementation of course just
returned the same value unchanged in case of a bytes value.

A simple fix would be to add an `if not isinstance(bytes, data)` check
before invoking the `_encode_data` function.

--
Ticket URL: <https://code.djangoproject.com/ticket/29520>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 23, 2018, 10:36:19 AM6/23/18
to django-...@googlegroups.com
#29520: Posting bytes broken in 2.1 TestClient
-----------------------------------+--------------------------------------

Reporter: Mathias Ertl | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 2.1
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by Herbert Fortes):

* cc: Herbert Fortes (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/29520#comment:1>

Django

unread,
Jun 25, 2018, 3:44:34 AM6/25/18
to django-...@googlegroups.com
#29520: Posting bytes broken in 2.1 TestClient
-----------------------------------+------------------------------------

Reporter: Mathias Ertl | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 2.1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by Claude Paroz):

* severity: Normal => Release blocker
* stage: Unreviewed => Accepted


Comment:

Simply reverting the commit (and adding a test with a `bytes`-POST data)
could also be considered.

--
Ticket URL: <https://code.djangoproject.com/ticket/29520#comment:2>

Django

unread,
Jun 27, 2018, 3:08:05 PM6/27/18
to django-...@googlegroups.com
#29520: test client crashes when posting bytes
-----------------------------------+------------------------------------

Reporter: Mathias Ertl | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 2.1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by Tim Graham):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/10101 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/29520#comment:3>

Django

unread,
Jun 27, 2018, 4:09:44 PM6/27/18
to django-...@googlegroups.com
#29520: test client crashes when posting bytes
-------------------------------------+-------------------------------------

Reporter: Mathias Ertl | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 2.1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/29520#comment:4>

Django

unread,
Jun 27, 2018, 5:10:40 PM6/27/18
to django-...@googlegroups.com
#29520: test client crashes when posting bytes
-------------------------------------+-------------------------------------
Reporter: Mathias Ertl | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 2.1
Severity: Release blocker | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"9294110a57ce0a6d14506969c950090045c622c8" 9294110a]:
{{{
#!CommitTicketReference repository=""
revision="9294110a57ce0a6d14506969c950090045c622c8"
Fixed #29520 -- Fixed test client crash when posting bytes.

Regression in b8a41a2872624a6d9e61308932dd81d001e31eb9.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29520#comment:5>

Django

unread,
Jun 27, 2018, 5:10:43 PM6/27/18
to django-...@googlegroups.com
#29520: test client crashes when posting bytes
-------------------------------------+-------------------------------------
Reporter: Mathias Ertl | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 2.1
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"01b7fdfd67a87e8c881e34d7ed97767c506b189c" 01b7fdfd]:
{{{
#!CommitTicketReference repository=""
revision="01b7fdfd67a87e8c881e34d7ed97767c506b189c"
[2.1.x] Fixed #29520 -- Fixed test client crash when posting bytes.

Regression in b8a41a2872624a6d9e61308932dd81d001e31eb9.

Backport of 9294110a57ce0a6d14506969c950090045c622c8 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29520#comment:6>

Reply all
Reply to author
Forward
0 new messages