class WrappedResponseTest(TestCase): def setUp(self): self.response = Response("http://www.example.com/page.html", headers={"Content-TYpe": "text/html"}) self.wrapped = WrappedResponse(self.response) def test_info(self): self.assert_(self.wrapped.info() is self.wrapped) def test_getheaders(self): self.assertEqual(self.wrapped.getheaders('content-type'), ['text/html'])
class WrappedResponseTest(TestCase): def setUp(self): self.response = Response("http://www.example.com/page.html", headers={"Content-TYpe": "text/html"}) self.wrapped = WrappedResponse(self.response) def test_info(self): self.assertIs(self.wrapped.info(), self.wrapped) def test_get_all(self): # get_all result must be native string self.assertEqual(self.wrapped.get_all('content-type'), ['text/html'])
class WrappedResponseTest(TestCase): def setUp(self): self.response = Response("http://www.example.com/page.html", headers={"Content-TYpe": "text/html"}) self.wrapped = WrappedResponse(self.response) def test_info(self): self.assert_(self.wrapped.info() is self.wrapped) def test_getheaders(self): self.assertEqual(self.wrapped.getheaders("content-type"), ["text/html"]) def test_get_all(self): # get_all result must be native string self.assertEqual(self.wrapped.get_all("content-type"), ["text/html"])
def setUp(self): self.response = Response("http://www.example.com/page.html", headers={"Content-TYpe": "text/html"}) self.wrapped = WrappedResponse(self.response)
def extract_cookies(self, response, request): wreq = WrappedRequest(request) wrsp = WrappedResponse(response) return super(CookieJar, self).extract_cookies(wrsp, wreq)
def make_cookies(self, response, request): if not isinstance(request, WrappedRequest): request = WrappedRequest(request) if not isinstance(response, WrappedResponse): response = WrappedResponse(response) return super(CookieJar, self).make_cookies(response, request)