cheroot.test.test_server module

Tests for the HTTP server.

class cheroot.test.test_server._TestGateway(req)

Bases: cheroot.server.Gateway

respond()

Process the current request. Must be overridden in a subclass.

send_payload(payload)
cheroot.test.test_server.many_open_sockets(resource_limit)

Allocate a lot of file descriptors by opening dummy sockets.

cheroot.test.test_server.peercreds_enabled_server(http_server, unix_sock_file)

Construct a test server with peercreds_enabled.

cheroot.test.test_server.resource_limit(request)

Set the resource limit two times bigger then requested.

cheroot.test.test_server.test_bind_addr_inet(http_server, ip_addr)

Check that bound IP address is stored in server.

cheroot.test.test_server.test_bind_addr_unix(http_server, unix_sock_file)

Check that bound UNIX socket address is stored in server.

cheroot.test.test_server.test_bind_addr_unix_abstract(http_server, unix_abstract_sock)

Check that bound UNIX abstract socket address is stored in server.

cheroot.test.test_server.test_high_number_of_file_descriptors(resource_limit)

Test the server does not crash with a high file-descriptor value.

This test shouldn’t cause a server crash when trying to access file-descriptor higher than 1024.

The earlier implementation used to rely on select() syscall that doesn’t support file descriptors with numbers higher than 1024.

cheroot.test.test_server.test_peercreds_unix_sock(peercreds_enabled_server)

Check that PEERCRED lookup works when enabled.

cheroot.test.test_server.test_peercreds_unix_sock_with_lookup(peercreds_enabled_server)

Check that PEERCRED resolution works when enabled.

cheroot.test.test_server.test_prepare_makes_server_ready()

Check that prepare() makes the server ready, and stop() clears it.

cheroot.test.test_server.test_stop_interrupts_serve()

Check that stop() interrupts running of serve().

cheroot.test.test_server.unix_abstract_sock()

Return an abstract UNIX socket address.

cheroot.test.test_server.unix_file_sock()

Yield a unix file socket.

cheroot.test.test_server.unix_sock_file(request)

Check that bound UNIX socket address is stored in server.