id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 13604 AssertRedirects test method tests the status code of initial response instead of the last redirect Jukka Välimaa nobody "In assertRedirects method of TestCase, the named parameter ""target_status_code"" should, according to the documentation, test the status code of the final point of the redirect chain. It is compared to the status code of the first redirecting response instead. This is how the code is: {{{ url, status_code = response.redirect_chain[-1] self.assertEqual(response.status_code, target_status_code, msg_prefix + ""Response didn't redirect as expected: Final"" "" Response code was %d (expected %d)"" % (response.status_code, target_status_code)) }}} Unless I've misunderstood something, the last line there should use ""status_code"" instead of ""response.status_code""." closed Testing framework 1.2 invalid assertRedirects Jukka Välimaa Unreviewed 0 0 0 0 0 0