cheroot.test.ssl.test_ssl_pyopenssl module#

Tests for cheroot.ssl.pyopenssl.

cheroot.test.ssl.test_ssl_pyopenssl.test_full_pyopenssl_environ_population(tls_certificate_pem_path, tls_certificate_private_key_pem_path, mocker)#

Test pyOpenSSL adapter populates WSGI environ with HTTP and SSL variables.

Performs an end-to-end test by: - Starting a WSGI server with pyOpenSSL TLS adapter - Making an SSL client connection - Sending an HTTP request over TLS - Verifying environ contains correct HTTP vars (METHOD, PATH, QUERY, etc.) - Verifying environ contains SSL vars (PROTOCOL, CIPHER, VERSION, DN, etc.)

This ensures the pyOpenSSL integration correctly exposes SSL connection details to WSGI applications through the environ dictionary.

cheroot.test.ssl.test_ssl_pyopenssl.test_handshake_error_handling(tls_certificate_pem_path, tls_certificate_private_key_pem_path, mocker, error_class, error_args, expected_exception, match_text)#

Test various error conditions during SSL handshake.

cheroot.test.ssl.test_ssl_pyopenssl.test_safe_call_coverage(test_case_name, call_method, mock_target, side_effects, expected_exception, expected_result, expected_call_count, mocker)#

Test all critical success, retry, and error-mapping paths in _safe_call.

cheroot.test.ssl.test_ssl_pyopenssl.test_streamreader_with_tls_socket(mocker)#

Test StreamReader works correctly with TLSSocket.

cheroot.test.ssl.test_ssl_pyopenssl.test_streamwriter_with_regular_socket(mocker)#

Test StreamWriter works correctly with regular socket.

cheroot.test.ssl.test_ssl_pyopenssl.test_tlssocket_io_handles_want_errors(mocker, io_method, error_class, call_target, test_input, expected_output)#

Test that TLSSocket I/O methods handle WantRead/WantWrite errors with retry.

cheroot.test.ssl.test_ssl_pyopenssl.test_tlssocket_is_readable(mocker)#

Test that TLSSocket properly declares itself as readable.

cheroot.test.ssl.test_ssl_pyopenssl.test_tlssocket_readinto_handles_syscallerror_eof(mocker)#

Test that TLSSocket.readinto() handles SysCallError with Unexpected EOF.

cheroot.test.ssl.test_ssl_pyopenssl.test_tlssocket_sock_shutdown(mocker)#

Test that sock_shutdown calls the raw socket’s shutdown method.

cheroot.test.ssl.test_ssl_pyopenssl.test_tlssocket_timeout_on_repeated_errors(mocker)#

Test that repeated SSL errors eventually timeout.

cheroot.test.ssl.test_ssl_pyopenssl.test_tlssocket_with_buffered_reader(mocker)#

Test that TLSSocket works correctly with io.BufferedReader.

cheroot.test.ssl.test_ssl_pyopenssl.test_wrap_with_pyopenssl_ssl_connection_creation_fails(tls_certificate_pem_path, tls_certificate_private_key_pem_path, mocker)#

Test that SSL.Connection creation error raises FatalSSLAlert.