Convert redirection-related tests to use assertRedirects.
Review Request #10477 — Created March 30, 2019 and submitted — Latest diff uploaded
We have a number of unit tests that check for HTTP responses that
redirect to a different URL, and most of these are checking headers and
response codes manually rather than usingassertRedirects
. The
advantage ofassertRedirects
is that we'd get the status codes and URL
checks built-in, but it also offers us a compatibility advantage. In
modern versions of Django, redirection URLs changed from absolute to
relative, andassertRedirects
knows how to factor this in for tests.This change updates these unit tests to use
assertRedirects
instead,
giving us compatibility across Django 1.6 and 1.11 for these tests.
Unit tests pass on Django 1.6 and 1.11.