From dd83f6123d54493661ae00ef668a5c2ee7d4e199 Mon Sep 17 00:00:00 2001 From: Artur Gaspar Date: Wed, 2 Sep 2015 11:36:15 -0300 Subject: [PATCH] Test for same response object in downloader middleware test. --- tests/test_downloadermiddleware.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_downloadermiddleware.py b/tests/test_downloadermiddleware.py index a5e765d9d..13f35b92a 100644 --- a/tests/test_downloadermiddleware.py +++ b/tests/test_downloadermiddleware.py @@ -97,9 +97,11 @@ class ResponseFromProcessRequestTest(ManagerTestCase): """Tests middleware returning a response from process_request.""" def test_download_func_not_called(self): + resp = Response('http://example.com/index.html') + class ResponseMiddleware(object): def process_request(self, request, spider): - return Response(request.url) + return resp self.mwman._add_middleware(ResponseMiddleware()) @@ -110,5 +112,5 @@ class ResponseFromProcessRequestTest(ManagerTestCase): dfd.addBoth(results.append) self._wait(dfd) - self.assertIsInstance(results[0], Response) + self.assertIs(results[0], resp) self.assertFalse(download_func.called)