cheroot.test.test_ssl module

Tests for TLS support.

class cheroot.test.test_ssl.HelloWorldGateway(req)

Bases: cheroot.wsgi.Gateway_10

Gateway responding with Hello World to root URI.

respond()

Respond with dummy content via HTTP.

cheroot.test.test_ssl._thread_except_hook(exceptions, args)

Append uncaught exception args in threads to exceptions.

cheroot.test.test_ssl.ca()

Provide a certificate authority via fixture.

cheroot.test.test_ssl.make_tls_http_server(bind_addr, ssl_adapter, request)

Create and start an HTTP server bound to bind_addr.

cheroot.test.test_ssl.test_http_over_https_error(tls_http_server, adapter_type, ca, ip_addr, tls_certificate, tls_certificate_chain_pem_path, tls_certificate_private_key_pem_path)

Ensure that connecting over HTTP to HTTPS port is handled.

cheroot.test.test_ssl.test_https_over_http_error(http_server, ip_addr)

Ensure that connecting over HTTPS to HTTP port is handled.

cheroot.test.test_ssl.test_ssl_adapters(tls_http_server, adapter_type, tls_certificate, tls_certificate_chain_pem_path, tls_certificate_private_key_pem_path, tls_ca_certificate_pem_path)

Test ability to connect to server via HTTPS using adapters.

cheroot.test.test_ssl.test_ssl_env(thread_exceptions, recwarn, mocker, tls_http_server, adapter_type, ca, tls_verify_mode, tls_certificate, tls_certificate_chain_pem_path, tls_certificate_private_key_pem_path, tls_ca_certificate_pem_path, use_client_cert)

Test the SSL environment generated by the SSL adapters.

cheroot.test.test_ssl.test_tls_client_auth(mocker, tls_http_server, adapter_type, ca, tls_certificate, tls_certificate_chain_pem_path, tls_certificate_private_key_pem_path, tls_ca_certificate_pem_path, is_trusted_cert, tls_client_identity, tls_verify_mode)

Verify that client TLS certificate auth works correctly.

cheroot.test.test_ssl.thread_exceptions()

Provide a list of uncaught exceptions from threads via a fixture.

Only catches exceptions on Python 3.8+. The list contains: (type, str(value), str(traceback))

cheroot.test.test_ssl.tls_ca_certificate_pem_path(ca)

Provide a certificate authority certificate file via fixture.

cheroot.test.test_ssl.tls_certificate(ca)

Provide a leaf certificate via fixture.

cheroot.test.test_ssl.tls_certificate_chain_pem_path(tls_certificate)

Provide a certificate chain PEM file path via fixture.

cheroot.test.test_ssl.tls_certificate_private_key_pem_path(tls_certificate)

Provide a certificate private key PEM file path via fixture.

cheroot.test.test_ssl.tls_http_server(request)

Provision a server creator as a fixture.