Exemplo n.º 1
0
 def test_post_with_urlencode(self):
     data = {'banana': 'hammock', 'lol': 'cat'}
     r = self.pool.request('POST',
                           '/echo',
                           fields=data,
                           encode_multipart=False)
     self.assertEqual(r.data.decode('utf-8'), urlencode(data))
Exemplo n.º 2
0
 def test_post_with_urlencode(self):
     data = {"banana": "hammock", "lol": "cat"}
     r = self.pool.request("POST",
                           "/echo",
                           fields=data,
                           encode_multipart=False)
     assert r.data.decode("utf-8") == urlencode(data)
Exemplo n.º 3
0
 def test_post_with_urlencode(self):
     with HTTPConnectionPool(self.host, self.port) as pool:
         data = {"banana": "hammock", "lol": "cat"}
         r = pool.request("POST",
                          "/echo",
                          fields=data,
                          encode_multipart=False)
         assert r.data.decode("utf-8") == urlencode(data)
Exemplo n.º 4
0
    def test_partial_response(self):
        with HTTPConnectionPool(self.host, self.port, maxsize=1) as pool:
            req_data = {"lol": "cat"}
            resp_data = urlencode(req_data).encode("utf-8")

            r = pool.request("GET", "/echo", fields=req_data, preload_content=False)

            assert r.read(5) == resp_data[:5]
            assert r.read() == resp_data[5:]
Exemplo n.º 5
0
    def test_partial_response(self):
        pool = HTTPConnectionPool(self.host, self.port, maxsize=1)

        req_data = {'lol': 'cat'}
        resp_data = urlencode(req_data).encode('utf-8')

        r = pool.request('GET', '/echo', fields=req_data, preload_content=False)

        self.assertEqual(r.read(5), resp_data[:5])
        self.assertEqual(r.read(), resp_data[5:])
Exemplo n.º 6
0
    def test_partial_response(self):
        pool = HTTPConnectionPool(self.host, self.port, maxsize=1)

        req_data = {'lol': 'cat'}
        resp_data = urlencode(req_data).encode('utf-8')

        r = pool.request('GET', '/echo', fields=req_data, preload_content=False)

        self.assertEqual(r.read(5), resp_data[:5])
        self.assertEqual(r.read(), resp_data[5:])
Exemplo n.º 7
0
    def test_partial_response(self):
        pool = HTTPConnectionPool(self.host, self.port, maxsize=1)
        self.addCleanup(pool.close)

        req_data = {"lol": "cat"}
        resp_data = urlencode(req_data).encode("utf-8")

        r = pool.request("GET",
                         "/echo",
                         fields=req_data,
                         preload_content=False)

        self.assertEqual(r.read(5), resp_data[:5])
        self.assertEqual(r.read(), resp_data[5:])
Exemplo n.º 8
0
 def test_post_with_urlencode(self):
     data = {'banana': 'hammock', 'lol': 'cat'}
     r = self.pool.request('POST', '/echo', fields=data, encode_multipart=False)
     self.assertEqual(r.data.decode('utf-8'), urlencode(data))