cherrypy.test.test_http module

Tests for managing HTTP issues (malformed requests, etc).

class cherrypy.test.test_http.HTTPTests(methodName='runTest')[source]

Bases: cherrypy.test.helper.CPWebCase

make_connection()[source]
static setup_server()[source]
test_garbage_in()[source]
test_http_over_https()[source]
test_malformed_header()[source]
test_malformed_request_line()[source]
test_no_content_length()[source]
test_post_filename_with_special_characters()[source]

Testing that we can handle filenames with special characters.

This was reported as a bug in:

test_post_multipart()[source]
test_request_line_split_issue_1220()[source]
cherrypy.test.test_http.encode_filename(filename)[source]

Given a filename to be used in a multipart/form-data, encode the name. Return the key and encoded filename.

cherrypy.test.test_http.encode_multipart_formdata(files)[source]

Return (content_type, body) ready for httplib.HTTP instance.

files: a sequence of (name, filename, value) tuples for multipart uploads. filename can be a string or a tuple (‘filename string’, ‘encoding’)

cherrypy.test.test_http.is_ascii(text)[source]

Return True if the text encodes as ascii.