diff options
Diffstat (limited to 'cherrypy/test/test_conn.py')
| -rw-r--r-- | cherrypy/test/test_conn.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/cherrypy/test/test_conn.py b/cherrypy/test/test_conn.py index 06676286..7d60c6fb 100644 --- a/cherrypy/test/test_conn.py +++ b/cherrypy/test/test_conn.py @@ -304,7 +304,7 @@ class PipelineTests(helper.CPWebCase): conn = self.HTTP_CONN conn.auto_open = False conn.connect() - conn.send(ntob('GET /hello HTTP/1.1')) + conn.send(b'GET /hello HTTP/1.1') conn.send(('Host: %s' % self.HOST).encode('ascii')) # Wait for our socket timeout @@ -337,7 +337,7 @@ class PipelineTests(helper.CPWebCase): self.assertBody(str(timeout)) # Make a second request on the same socket - conn._output(ntob('GET /hello HTTP/1.1')) + conn._output(b'GET /hello HTTP/1.1') conn._output(ntob('Host: %s' % self.HOST, 'ascii')) conn._send_output() response = conn.response_class(conn.sock, method='GET') @@ -350,7 +350,7 @@ class PipelineTests(helper.CPWebCase): time.sleep(timeout * 2) # Make another request on the same socket, which should error - conn._output(ntob('GET /hello HTTP/1.1')) + conn._output(b'GET /hello HTTP/1.1') conn._output(ntob('Host: %s' % self.HOST, 'ascii')) conn._send_output() response = conn.response_class(conn.sock, method='GET') @@ -383,7 +383,7 @@ class PipelineTests(helper.CPWebCase): # Make another request on the same socket, # but timeout on the headers - conn.send(ntob('GET /hello HTTP/1.1')) + conn.send(b'GET /hello HTTP/1.1') # Wait for our socket timeout time.sleep(timeout * 2) response = conn.response_class(conn.sock, method='GET') @@ -431,7 +431,7 @@ class PipelineTests(helper.CPWebCase): for trial in range(5): # Put next request - conn._output(ntob('GET /hello HTTP/1.1')) + conn._output(b'GET /hello HTTP/1.1') conn._output(ntob('Host: %s' % self.HOST, 'ascii')) conn._send_output() @@ -446,14 +446,14 @@ class PipelineTests(helper.CPWebCase): response.begin() body = response.read(13) self.assertEqual(response.status, 200) - self.assertEqual(body, ntob('Hello, world!')) + self.assertEqual(body, b'Hello, world!') # Retrieve final response response = conn.response_class(conn.sock, method='GET') response.begin() body = response.read() self.assertEqual(response.status, 200) - self.assertEqual(body, ntob('Hello, world!')) + self.assertEqual(body, b'Hello, world!') conn.close() @@ -506,7 +506,7 @@ class PipelineTests(helper.CPWebCase): break # ...send the body - body = ntob('I am a small file') + body = b'I am a small file' conn.send(body) # ...get the final response @@ -566,11 +566,11 @@ class ConnectionTests(helper.CPWebCase): self.assertStatus(500) # Now try a working page with an Expect header... - conn._output(ntob('POST /upload HTTP/1.1')) + conn._output(b'POST /upload HTTP/1.1') conn._output(ntob('Host: %s' % self.HOST, 'ascii')) - conn._output(ntob('Content-Type: text/plain')) - conn._output(ntob('Content-Length: 17')) - conn._output(ntob('Expect: 100-continue')) + conn._output(b'Content-Type: text/plain') + conn._output(b'Content-Length: 17') + conn._output(b'Expect: 100-continue') conn._send_output() response = conn.response_class(conn.sock, method='POST') @@ -583,7 +583,7 @@ class ConnectionTests(helper.CPWebCase): break # ...send the body - body = ntob('I am a small file') + body = b'I am a small file' conn.send(body) # ...get the final response @@ -654,7 +654,7 @@ class ConnectionTests(helper.CPWebCase): response = conn.getresponse() self.status, self.headers, self.body = webtest.shb(response) self.assertStatus('200 OK') - self.assertBody("thanks for '%s'" % ntob('xx\r\nxxxxyyyyy')) + self.assertBody("thanks for '%s'" % b'xx\r\nxxxxyyyyy') # Try a chunked request that exceeds server.max_request_body_size. # Note that the delimiters and trailer are included. @@ -839,7 +839,7 @@ class LimitedRequestQueueTests(helper.CPWebCase): raise AssertionError('Overflow conn did not get RST ') finally: for conn in conns: - conn.send(ntob('done')) + conn.send(b'done') response = conn.response_class(conn.sock, method='POST') response.begin() self.body = response.read() @@ -857,7 +857,7 @@ class BadRequestTests(helper.CPWebCase): self.persistent = True conn = self.HTTP_CONN - conn.send(ntob('GET /hello HTTP/1.1\n\n')) + conn.send(b'GET /hello HTTP/1.1\n\n') response = conn.response_class(conn.sock, method='GET') response.begin() self.body = response.read() @@ -865,7 +865,7 @@ class BadRequestTests(helper.CPWebCase): conn.close() conn.connect() - conn.send(ntob('GET /hello HTTP/1.1\r\n\n')) + conn.send(b'GET /hello HTTP/1.1\r\n\n') response = conn.response_class(conn.sock, method='GET') response.begin() self.body = response.read() |
