PY3 fix AjacCrawlable middleware tests

This commit is contained in:
Mikhail Korobov 2015-09-01 03:49:52 +05:00
parent b876755f1c
commit 45101829a5
2 changed files with 2 additions and 3 deletions

View File

@ -6,7 +6,6 @@ tests/test_exporters.py
tests/test_linkextractors_deprecated.py
tests/test_crawl.py
tests/test_downloader_handlers.py
tests/test_downloadermiddleware_ajaxcrawlable.py
tests/test_downloadermiddleware_defaultheaders.py
tests/test_downloadermiddleware_downloadtimeout.py
tests/test_downloadermiddleware_httpauth.py

View File

@ -14,7 +14,7 @@ class AjaxCrawlMiddlewareTest(unittest.TestCase):
self.mw = AjaxCrawlMiddleware.from_crawler(crawler)
def _ajaxcrawlable_body(self):
return '<html><head><meta name="fragment" content="!"/></head><body></body></html>'
return b'<html><head><meta name="fragment" content="!"/></head><body></body></html>'
def _req_resp(self, url, req_kwargs=None, resp_kwargs=None):
req = Request(url, **(req_kwargs or {}))
@ -53,6 +53,6 @@ class AjaxCrawlMiddlewareTest(unittest.TestCase):
assert resp3 is resp2
def test_noncrawlable_body(self):
req, resp = self._req_resp('http://example.com/', {}, {'body': '<html></html>'})
req, resp = self._req_resp('http://example.com/', {}, {'body': b'<html></html>'})
resp2 = self.mw.process_response(req, resp, self.spider)
self.assertIs(resp, resp2)