#5538: assertRedirects should assume http://testserver if it isn't provided
------------------------------------------+---------------------------------
   Reporter:  russellm                    |                Owner:  nobody       
   
     Status:  new                         |            Component:  Unit test 
system
    Version:  SVN                         |           Resolution:               
   
   Keywords:  assertRedirects testserver  |                Stage:  Accepted     
   
  Has_patch:  0                           |           Needs_docs:  0            
   
Needs_tests:  0                           |   Needs_better_patch:  0            
   
------------------------------------------+---------------------------------
Changes (by russellm):

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

Old description:

> [6164] fixed #987, a problem with redirects allowing relative URIs. The
> fix is correct, but it makes the testing API slightly unwieldy; all calls
> to assertRedirects() now require that ``'http://testserver'`` be part of
> the asserted URL.
>
> The vast majority of redirection tests will be internal to the site, so
> requiring the full dummy host prefix only serves to muddy the tests. This
> is made worse by the fact that urlresolvers.reverse() doesn't include the
> testserver component, so assertRedirects(reverse('some_name')) doesn't
> work.
>
> assertRedirects should be modified to inspect the test URL; if no '://'
> doesn't occur in the test url, 'http://testserver' should be prepended
> for test purposes. i.e.,
>
> ``assertRedirects('/some/url')`` is equivalent to
> ``assertRedirects('http://testserver/some/url')``
> ``assertRedirects('http://otherserver/some/url')`` would be untouched

New description:

 [6164] fixed #987, a problem with redirects allowing relative URIs. The
 fix is correct, but it makes the testing API slightly unwieldy; all calls
 to assertRedirects() now require that ``'http://testserver'`` be part of
 the asserted URL.

 The vast majority of redirection tests will be internal to the site, so
 requiring the full dummy host prefix only serves to muddy the tests. This
 is made worse by the fact that urlresolvers.reverse() doesn't include the
 testserver component, so assertRedirects(reverse('some_name')) doesn't
 work.

 assertRedirects should be modified to inspect the test URL; if no '://'
 doesn't occur in the test url, 'http://testserver' should be prepended for
 test purposes. i.e.,

 ``assertRedirects('/some/url')`` is equivalent to
 ``assertRedirects('http://testserver/some/url')``

 ``assertRedirects('http://otherserver/some/url')`` would be untouched

-- 
Ticket URL: <http://code.djangoproject.com/ticket/5538#comment:1>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to