def test_read_request_head(): rfile = BytesIO(b"GET / HTTP/1.1\r\n" b"Content-Length: 4\r\n" b"\r\n" b"skip") rfile.reset_timestamps = Mock() rfile.first_byte_timestamp = 42 r = read_request_head(rfile) assert r.method == "GET" assert r.headers["Content-Length"] == "4" assert r.content is None assert rfile.reset_timestamps.called assert r.timestamp_start == 42 assert rfile.read() == b"skip"
def test_read_request_head(): rfile = BytesIO( b"GET / HTTP/1.1\r\n" b"Content-Length: 4\r\n" b"\r\n" b"skip" ) rfile.reset_timestamps = Mock() rfile.first_byte_timestamp = 42 r = read_request_head(rfile) assert r.method == "GET" assert r.headers["Content-Length"] == "4" assert r.content is None assert rfile.reset_timestamps.called assert r.timestamp_start == 42 assert rfile.read() == b"skip"