[Django] #20919: assertRedirects without loading the target page

13 views
Skip to first unread message

Django

unread,
Aug 14, 2013, 8:43:17 AM8/14/13
to django-...@googlegroups.com
#20919: assertRedirects without loading the target page
-----------------------------------+-----------------------------
Reporter: mjtamlyn | Owner: nobody
Type: New feature | Status: new
Component: Testing framework | Version: master
Severity: Normal | Keywords: assertRedirects
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+-----------------------------
It would be nice to have a version/extension of `assertRedirects` which
does not require loading the target page with the client. My test suites
already have tests for the target pages in most cases, and the extra
overhead of calling and rendering the second page each time seems like
overkill. The general thing I want to test is "this response redirects to
the url with name 'foo'" rather than "this response redirects to url /foo
and it works".

This would also handle the issue of checking redirects to external sites
without having to go hunting for `headers['Location']`.

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

Django

unread,
Aug 16, 2013, 9:51:23 AM8/16/13
to django-...@googlegroups.com
#20919: assertRedirects without loading the target page
-----------------------------------+------------------------------------

Reporter: mjtamlyn | Owner: nobody
Type: New feature | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: assertRedirects | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted


Comment:

I've also wished for this.

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

Django

unread,
Sep 7, 2013, 3:42:59 PM9/7/13
to django-...@googlegroups.com
#20919: assertRedirects without loading the target page
-----------------------------------+------------------------------------
Reporter: mjtamlyn | Owner: jcatalan
Type: New feature | Status: assigned

Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: assertRedirects | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

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


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

Django

unread,
Sep 7, 2013, 5:41:08 PM9/7/13
to django-...@googlegroups.com
#20919: assertRedirects without loading the target page
-----------------------------------+------------------------------------
Reporter: mjtamlyn | Owner: jcatalan
Type: New feature | Status: assigned
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: assertRedirects | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by jcatalan):

I also wanted this once, so I think it would be a useful thing to have.
I've submitted this [https://github.com/django/django/pull/1598 PR] with a
patch. Please, let me know what do you think!

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

Django

unread,
Sep 7, 2013, 5:41:22 PM9/7/13
to django-...@googlegroups.com
#20919: assertRedirects without loading the target page
-----------------------------------+------------------------------------
Reporter: mjtamlyn | Owner: jcatalan
Type: New feature | Status: assigned
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: assertRedirects | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* has_patch: 0 => 1


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

Django

unread,
Sep 10, 2013, 12:24:37 PM9/10/13
to django-...@googlegroups.com
#20919: assertRedirects without loading the target page
-----------------------------------+------------------------------------
Reporter: mjtamlyn | Owner: jcatalan
Type: New feature | Status: closed

Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed

Keywords: assertRedirects | 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 <timograham@…>):

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


Comment:

In [changeset:"4840fd9cbc3987781f7e6fab2520c9bd42aec057"]:
{{{
#!CommitTicketReference repository=""
revision="4840fd9cbc3987781f7e6fab2520c9bd42aec057"
Fixed #20919 -- Extended assertRedirects to be able to avoid fetching
redirect's response.

Thanks mjtamlyn for the suggestion.
}}}

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

Reply all
Reply to author
Forward
0 new messages