コード例 #1
0
ファイル: test_http_cookies.py プロジェクト: 00gpowe/scrapy
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'])
コード例 #2
0
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'])
コード例 #3
0
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'])
コード例 #4
0
ファイル: test_http_cookies.py プロジェクト: CNGong/scrapy
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"])
コード例 #5
0
ファイル: test_http_cookies.py プロジェクト: Prime-5/scrapy-1
 def setUp(self):
     self.response = Response("http://www.example.com/page.html",
                              headers={"Content-TYpe": "text/html"})
     self.wrapped = WrappedResponse(self.response)
コード例 #6
0
 def setUp(self):
     self.response = Response("http://www.example.com/page.html",
                              headers={"Content-TYpe": "text/html"})
     self.wrapped = WrappedResponse(self.response)
コード例 #7
0
 def extract_cookies(self, response, request):
     wreq = WrappedRequest(request)
     wrsp = WrappedResponse(response)
     return super(CookieJar, self).extract_cookies(wrsp, wreq)
コード例 #8
0
 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)