[Django] #27113: Add tests for setting HttpRequest.encoding

24 views
Skip to first unread message

Django

unread,
Aug 23, 2016, 11:38:46 AM8/23/16
to django-...@googlegroups.com
#27113: Add tests for setting HttpRequest.encoding
------------------------------------------------+------------------------
Reporter: timgraham | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: HTTP handling | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
Looking at Django's coverage report, I found some untested lines:
[https://github.com/django/django/blob/bc1e2d8e8edde6cc7d2657c68242a13ee65a15b8/django/http/request.py#L227-L231].
Removing them doesn't cause any tests to fail.

A test should be added to demonstrate
[https://docs.djangoproject.com/en/dev/ref/request-
response/#django.http.HttpRequest.encoding the documented behavior]:

You can write to `HttpRequest.encoding` to change the encoding used when
accessing the form data. Any subsequent attribute accesses (such as
reading from GET or POST) will use the new encoding value.

The test might look similar the following test, but should use a value
that appears differently after the encoding changes:

https://code.djangoproject.com/attachment/ticket/27107/27107-test.diff

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

Django

unread,
Aug 29, 2016, 12:34:12 PM8/29/16
to django-...@googlegroups.com
#27113: Add tests for setting HttpRequest.encoding
--------------------------------------+------------------------------------
Reporter: timgraham | Owner: PREM1980
Type: Cleanup/optimization | Status: assigned

Component: HTTP handling | Version: 1.10
Severity: Normal | 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 PREM1980):

* owner: nobody => PREM1980
* status: new => assigned


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

Django

unread,
Aug 29, 2016, 2:50:53 PM8/29/16
to django-...@googlegroups.com
#27113: Add tests for setting HttpRequest.encoding
--------------------------------------+------------------------------------
Reporter: timgraham | Owner: PREM1980
Type: Cleanup/optimization | Status: assigned
Component: HTTP handling | Version: 1.10
Severity: Normal | 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 PREM1980):

* has_patch: 0 => 1


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

Django

unread,
Aug 29, 2016, 2:52:40 PM8/29/16
to django-...@googlegroups.com
#27113: Add tests for setting HttpRequest.encoding
--------------------------------------+------------------------------------
Reporter: timgraham | Owner: PREM1980
Type: Cleanup/optimization | Status: assigned
Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

Comment (by PREM1980):

https://github.com/django/django/pull/7179

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

Django

unread,
Aug 30, 2016, 11:50:20 AM8/30/16
to django-...@googlegroups.com
#27113: Add tests for setting HttpRequest.encoding
--------------------------------------+------------------------------------
Reporter: timgraham | Owner: PREM1980
Type: Cleanup/optimization | Status: assigned
Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* needs_better_patch: 0 => 1


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

Django

unread,
Aug 30, 2016, 4:50:14 PM8/30/16
to django-...@googlegroups.com
#27113: Add tests for setting HttpRequest.encoding
--------------------------------------+------------------------------------
Reporter: timgraham | Owner: PREM1980
Type: Cleanup/optimization | Status: assigned
Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by PREM1980):

Replying to [comment:4 timgraham]:

Fixed all the issues and included test for POST request. As mentioned
earlier, GET as a different problem and will open a different ticket to
track it.
https://github.com/django/django/pull/7185

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

Django

unread,
Aug 30, 2016, 9:05:19 PM8/30/16
to django-...@googlegroups.com
#27113: Add tests for setting HttpRequest.encoding
--------------------------------------+------------------------------------
Reporter: timgraham | Owner: PREM1980
Type: Cleanup/optimization | Status: closed

Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

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


Comment:

In [changeset:"c41fd66f774b0d67876d3d22beeb783ab5bfa442" c41fd66f]:
{{{
#!CommitTicketReference repository=""
revision="c41fd66f774b0d67876d3d22beeb783ab5bfa442"
Fixed #27113 -- Tested that setting HttpRequest.encoding clears POST.
}}}

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

Django

unread,
Aug 30, 2016, 9:27:57 PM8/30/16
to django-...@googlegroups.com
#27113: Test that setting HttpRequest.encoding clears POST

--------------------------------------+------------------------------------
Reporter: timgraham | Owner: PREM1980
Type: Cleanup/optimization | Status: closed
Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by timgraham):

I created #27156 for the follow up ticket.

--
Ticket URL: <https://code.djangoproject.com/ticket/27113#comment:7>

Reply all
Reply to author
Forward
0 new messages