def test_redirects(self):
        redirect = Redirect.objects.create(
            old_path='/old_path/',
            new_path='http://redirected.example.com',
            site=Site.objects.get_current()
        )
        url = redirect.old_path
        response = self.client.get(url)
        self.assertEqual(response.status_code, 301)
        self.assertEqual(response['Location'], redirect.new_path)
More of a sanity check just in case some other middleware interferes.
dataset/ETHPy150Open python/pythondotorg/pydotorg/tests/test_middleware.py/MiddlewareTests.test_redirects