def test_assemble_request_line(): assert _assemble_request_line(treq().data) == b"GET /path HTTP/1.1" authority_request = treq(method=b"CONNECT", first_line_format="authority").data assert _assemble_request_line(authority_request) == b"CONNECT address:22 HTTP/1.1" absolute_request = treq(first_line_format="absolute").data assert _assemble_request_line(absolute_request) == b"GET http://address:22/path HTTP/1.1" with raises(RuntimeError): _assemble_request_line(treq(first_line_format="invalid_form").data)