Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

fix tests after changes introduced by scrapy/w3lib#21

Daniel Graña2ba78e715b76
diff --git a/scrapy/tests/test_http_request.py b/scrapy/tests/test_http_request.py
index e438a51ce..ebcee8c1d 100644
--- a/scrapy/tests/test_http_request.py
+++ b/scrapy/tests/test_http_request.py
@@ -108,10 +108,10 @@ class RequestTest(unittest.TestCase):
def test_ajax_url(self):
# ascii url
r = self.request_class(url="http://www.example.com/ajax.html#!key=value")
- self.assertEqual(r.url, "http://www.example.com/ajax.html?_escaped_fragment_=key=value")
+ self.assertEqual(r.url, "http://www.example.com/ajax.html?_escaped_fragment_=key%3Dvalue")
# unicode url
r = self.request_class(url=u"http://www.example.com/ajax.html#!key=value")
- self.assertEqual(r.url, "http://www.example.com/ajax.html?_escaped_fragment_=key=value")
+ self.assertEqual(r.url, "http://www.example.com/ajax.html?_escaped_fragment_=key%3Dvalue")
def test_copy(self):
"""Test Request copy"""
diff --git a/scrapy/utils/url.py b/scrapy/utils/url.py
index 9a12aa26b..3c86a6edb 100644
--- a/scrapy/utils/url.py
+++ b/scrapy/utils/url.py
@@ -82,11 +82,11 @@ def escape_ajax(url):
http://code.google.com/web/ajaxcrawling/docs/getting-started.html
>>> escape_ajax("www.example.com/ajax.html#!key=value")
- 'www.example.com/ajax.html?_escaped_fragment_=key=value'
+ 'www.example.com/ajax.html?_escaped_fragment_=key%3Dvalue'
>>> escape_ajax("www.example.com/ajax.html?k1=v1&k2=v2#!key=value")
- 'www.example.com/ajax.html?k1=v1&k2=v2&_escaped_fragment_=key=value'
+ 'www.example.com/ajax.html?k1=v1&k2=v2&_escaped_fragment_=key%3Dvalue'
>>> escape_ajax("www.example.com/ajax.html?#!key=value")
- 'www.example.com/ajax.html?_escaped_fragment_=key=value'
+ 'www.example.com/ajax.html?_escaped_fragment_=key%3Dvalue'
>>> escape_ajax("www.example.com/ajax.html#!")
'www.example.com/ajax.html?_escaped_fragment_='