assertRedirects should assume http://testserver if it isn't provided
|Reported by:||Russell Keith-Magee||Owned by:||anonymous|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Description (last modified by )
 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
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.,
is equivalent to
would be untouched
Change History (6)
comment:4 Changed 9 years ago by
|Owner:||changed from nobody to anonymous|
|Status:||new → assigned|