def test_perform_request_performs_request(self): """ _perform_request() should perform the request and return a Response object. """ req = scraper._create_request(year=2000, url=LOCAL_URL) with patch.object(Session, "send", return_value=Response()): resp = scraper._perform_request(req) assert isinstance(resp, Response)
def test_perform_request_performs_request_and_gets_data(self): """ _perform_request() should perform the request and return a Response object which contains the correct HTML. """ req = scraper._create_request(year=2000, url=LOCAL_URL) fake_resp = Response() fake_resp._content = self.example_html with patch.object(Session, "send", return_value=fake_resp): resp = scraper._perform_request(req) assert resp.text == fake_resp.text