mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
Tested text_response_server
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user