def setUp(self): TestCase.setUp(self) # /~\ # C oo # _( ^) #/ ~\ # monkey patch the fetcher to use the test client def monkeypatched_fetch(url, timeout): url = url.replace('http://testserver', '') response = self.client.get(url) return response._headers, response.content self.orig_fetch = spider_utils.fetch_url spider_utils.fetch_url = monkeypatched_fetch
def tearDown(self): TestCase.tearDown(self) spider_utils.fetch_url = self.orig_fetch