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))
 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)
 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)
    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:]
    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:])
    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:])
    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:])
 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))