'Unit tests for handling of Redirect exceptions.'

def test_redirect_exceptions(self):

    request = RequestFactory().get('dummy_url')
    test_url = '/test_url'
    exception = Redirect(test_url)
    response = RedirectMiddleware().process_exception(request, exception)
    self.assertEqual(response.status_code, 302)
    target_url = response._headers['location'][1]
    self.assertTrue(target_url.endswith(test_url))
