From 4a41c591f88c3be7bb1319c8e6b8eba631fea8da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Braulio=20Valdivielso=20Mart=C3=ADnez?= Date: Tue, 8 Dec 2015 16:23:02 +0100 Subject: [PATCH] Tested text_response_server --- test_requests.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test_requests.py b/test_requests.py index 5c91c20a..29773bda 100755 --- a/test_requests.py +++ b/test_requests.py @@ -1784,6 +1784,20 @@ class TestTestServer(unittest.TestCase): with pytest.raises(socket.error): new_sock = socket.socket() new_sock.connect((host, port)) + + def test_text_response(self): + server = Server.text_response_server( + "HTTP/1.1 200 OK\r\n" + + "Content-Length: 6\r\n" + + "\r\nroflol" + ) + + with server as (host, port): + r = requests.get('http://{}:{}'.format(host, port)) + + assert r.status_code == 200 + assert r.text == 'roflol' + assert r.headers['Content-Length'] == '6' def test_basic_response(self): with Server.basic_response_server() as (host, port):