Scrapy, a fast high-level web crawling & scraping framework for Python.
adding test for latin1 location
Elias Dorneles179c4588ca12
diff --git a/tests/test_downloadermiddleware_redirect.py b/tests/test_downloadermiddleware_redirect.pyindex 15e1dff37..11d9fd152 100644--- a/tests/test_downloadermiddleware_redirect.py+++ b/tests/test_downloadermiddleware_redirect.py@@ -1,3 +1,5 @@+# -*- coding: utf-8 -*-+import unittestfrom scrapy.downloadermiddlewares.redirect import RedirectMiddleware, MetaRefreshMiddleware@@ -150,6 +152,14 @@ class RedirectMiddlewareTest(unittest.TestCase):[404, 301, 302]}))_test_passthrough(Request(url, meta={'handle_httpstatus_all': True}))+ def test_latin1_location(self):+ req = Request('http://scrapytest.org/first')+ latin1_path = u'/ação'.encode('latin1')+ resp = Response('http://scrapytest.org/first', headers={'Location': latin1_path}, status=302)+ req_result = self.mw.process_response(req, resp, self.spider)+ perc_encoded_utf8_url = 'http://scrapytest.org/a%C3%A7%C3%A3o'+ self.assertEquals(perc_encoded_utf8_url, req_result.url)+class MetaRefreshMiddlewareTest(unittest.TestCase):