MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_wrap_socket

Function test_wrap_socket

Lib/test/test_ssl.py:261–280  ·  view source on GitHub ↗
(sock, *,
                     cert_reqs=ssl.CERT_NONE, ca_certs=None,
                     ciphers=None, certfile=None, keyfile=None,
                     **kwargs)

Source from the content-addressed store, hash-verified

259
260
261def test_wrap_socket(sock, *,
262 cert_reqs=ssl.CERT_NONE, ca_certs=None,
263 ciphers=None, certfile=None, keyfile=None,
264 **kwargs):
265 if not kwargs.get("server_side"):
266 kwargs["server_hostname"] = SIGNED_CERTFILE_HOSTNAME
267 context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
268 else:
269 context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
270 if cert_reqs is not None:
271 if cert_reqs == ssl.CERT_NONE:
272 context.check_hostname = False
273 context.verify_mode = cert_reqs
274 if ca_certs is not None:
275 context.load_verify_locations(ca_certs)
276 if certfile is not None or keyfile is not None:
277 context.load_cert_chain(certfile, keyfile)
278 if ciphers is not None:
279 context.set_ciphers(ciphers)
280 return context.wrap_socket(sock, **kwargs)
281
282
283USE_SAME_TEST_CONTEXT = False

Callers 15

test_refcycleMethod · 0.85
test_timeoutMethod · 0.85
bad_cert_testMethod · 0.85
test_dealloc_warnMethod · 0.85
test_unsupported_dtlsMethod · 0.85
test_connect_ex_errorMethod · 0.85
test_connectMethod · 0.85
test_connect_failMethod · 0.85
test_connect_exMethod · 0.85

Calls 5

wrap_socketMethod · 0.95
getMethod · 0.45
load_verify_locationsMethod · 0.45
load_cert_chainMethod · 0.45
set_ciphersMethod · 0.45

Tested by

no test coverage detected