'Redirections to self are caught and escaped'

def test_redirect_chain_to_self(self):

    with self.assertRaises(RedirectCycleError) as context:
        self.client.get('/redirect_to_self/', {}, follow=True)
    response = context.exception.last_response
    self.assertRedirects(response, '/redirect_to_self/', status_code=302, target_status_code=302)
    self.assertEqual(len(response.redirect_chain), 2)
