[Django] #21341: Add a secure kwarg to testing client request methods

9 views
Skip to first unread message

Django

unread,
Oct 28, 2013, 4:28:56 AM10/28/13
to django-...@googlegroups.com
#21341: Add a secure kwarg to testing client request methods
------------------------------+--------------------------------------------
Reporter: unaizalakain | Owner: unaizalakain
Type: New feature | Status: new
Component: Testing | Version: master
framework | Keywords: testing, client, https, secure
Severity: Normal | Has patch: 0
Triage Stage: Unreviewed | UI/UX: 0
Easy pickings: 0 |
------------------------------+--------------------------------------------
This is the current way of making an https request with the testing
client:


{{{
from django.test import Client

client = Client()
client.get('/', {'wsgi.url_scheme': 'https'})
}}}

This is quite obscure and undocumented, something like ``client.get('/',
secure=True)`` would be far cleaner. The way ``django.test.client.Client``
and ``django.test.client.RequestFactory`` are build, we would need to
modify each request method in both of them.

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

Django

unread,
Oct 28, 2013, 4:30:46 AM10/28/13
to django-...@googlegroups.com
#21341: Clean way for making https request with test client
-------------------------------------+-------------------------------------
Reporter: unaizalakain | Owner:
Type: New feature | unaizalakain
Component: Testing framework | Status: new
Severity: Normal | Version: master
Keywords: testing, client, | Resolution:
https, secure | Triage Stage:
Has patch: 0 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by unaizalakain):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


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

Django

unread,
Oct 28, 2013, 4:31:16 AM10/28/13
to django-...@googlegroups.com
#21341: Clean way of making https request with test client

-------------------------------------+-------------------------------------
Reporter: unaizalakain | Owner:
Type: New feature | unaizalakain
Component: Testing framework | Status: new
Severity: Normal | Version: master
Keywords: testing, client, | Resolution:
https, secure | Triage Stage:
Has patch: 0 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------

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

Django

unread,
Oct 28, 2013, 4:31:47 AM10/28/13
to django-...@googlegroups.com
#21341: Clean way of making https requests with test client

-------------------------------------+-------------------------------------
Reporter: unaizalakain | Owner:
Type: New feature | unaizalakain
Component: Testing framework | Status: new
Severity: Normal | Version: master
Keywords: testing, client, | Resolution:
https, secure | Triage Stage:
Has patch: 0 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------

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

Django

unread,
Oct 28, 2013, 5:34:37 AM10/28/13
to django-...@googlegroups.com
#21341: Clean way of making https requests with test client
-------------------------------------+-------------------------------------
Reporter: unaizalakain | Owner:
Type: New feature | unaizalakain
Component: Testing framework | Status: new
Severity: Normal | Version: master
Keywords: testing, client, | Resolution:
https, secure | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* stage: Unreviewed => Accepted


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

Django

unread,
Oct 28, 2013, 10:06:03 AM10/28/13
to django-...@googlegroups.com
#21341: Clean way of making https requests with test client
-------------------------------------+-------------------------------------
Reporter: unaizalakain | Owner:
Type: New feature | unaizalakain
Component: Testing framework | Status: new
Severity: Normal | Version: master
Keywords: testing, client, | Resolution:
https, secure | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* has_patch: 0 => 1


Comment:

PR sent: https://github.com/django/django/pull/1820

All the request methods of django.test.client.Client receive a secure
argument that defaults to False indicating wether or not to make the
request through https.

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

Django

unread,
Oct 28, 2013, 6:58:44 PM10/28/13
to django-...@googlegroups.com
#21341: Clean way of making https requests with test client
-------------------------------------+-------------------------------------
Reporter: unaizalakain | Owner:
Type: New feature | unaizalakain
Component: Testing framework | Status: new
Severity: Normal | Version: master
Keywords: testing, client, | Resolution:
https, secure | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by unaizalakain):

This would make #13725 easier too.

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

Django

unread,
Oct 28, 2013, 7:16:19 PM10/28/13
to django-...@googlegroups.com
#21341: Clean way of making https requests with test client
-------------------------------------+-------------------------------------
Reporter: unaizalakain | Owner:
Type: New feature | unaizalakain
Component: Testing framework | Status: assigned

Severity: Normal | Version: master
Keywords: testing, client, | Resolution:
https, secure | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by unaizalakain):

* status: new => assigned


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

Django

unread,
Oct 30, 2013, 7:10:39 AM10/30/13
to django-...@googlegroups.com
#21341: Clean way of making https requests with test client
-------------------------------------+-------------------------------------
Reporter: unaizalakain | Owner:
Type: New feature | unaizalakain
Component: Testing framework | Status: assigned
Severity: Normal | Version: master
Keywords: testing, client, | Resolution:
https, secure | Triage Stage: Ready for
Has patch: 1 | checkin

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

* stage: Accepted => Ready for checkin


Comment:

This looks pretty good to me. I left a few comments on the pull request.
I'm marking as RFC anyway because these comments are minor and could be
made by the committer.

--
Ticket URL: <https://code.djangoproject.com/ticket/21341#comment:8>

Django

unread,
Oct 30, 2013, 7:17:46 AM10/30/13
to django-...@googlegroups.com
#21341: Clean way of making https requests with test client
-------------------------------------+-------------------------------------
Reporter: unaizalakain | Owner:
Type: New feature | unaizalakain
Component: Testing framework | Status: assigned
Severity: Normal | Version: master
Keywords: testing, client, | Resolution:
https, secure | Triage Stage: Ready for
Has patch: 1 | checkin
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by unaizalakain):

Thanks for the review, suggestions applied!

--
Ticket URL: <https://code.djangoproject.com/ticket/21341#comment:9>

Django

unread,
Nov 2, 2013, 2:10:04 PM11/2/13
to django-...@googlegroups.com
#21341: Clean way of making https requests with test client
-------------------------------------+-------------------------------------
Reporter: unaizalakain | Owner:
Type: New feature | unaizalakain
Component: Testing framework | Status: closed
Severity: Normal | Version: master
Keywords: testing, client, | Resolution: fixed

https, secure | Triage Stage: Ready for
Has patch: 1 | checkin
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

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


Comment:

In: 99b681e227b5b7880d6edd0d8dd670034d431859

Fixed #21341 -- Eased https requests with the test client

--
Ticket URL: <https://code.djangoproject.com/ticket/21341#comment:10>

Reply all
Reply to author
Forward
0 new messages