MCPcopy Index your code
hub / github.com/python/cpython / test_ciphersuites

Method test_ciphersuites

Lib/test/test_ssl.py:2464–2481  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2462 self.server_addr = (HOST, server.port)
2463
2464 def test_ciphersuites(self):
2465 # Test unrecognized TLS 1.3 cipher suite name
2466 with (
2467 socket.socket(socket.AF_INET) as sock,
2468 self.assertRaisesRegex(ssl.SSLError,
2469 "No cipher suite can be selected")
2470 ):
2471 test_wrap_socket(sock, cert_reqs=ssl.CERT_NONE,
2472 ciphersuites="XXX",
2473 min_version=ssl.TLSVersion.TLSv1_3)
2474
2475 # Test successful TLS 1.3 handshake
2476 with test_wrap_socket(socket.socket(socket.AF_INET),
2477 cert_reqs=ssl.CERT_NONE,
2478 ciphersuites=self.matching_cipher,
2479 min_version=ssl.TLSVersion.TLSv1_3) as s:
2480 s.connect(self.server_addr)
2481 self.assertEqual(s.cipher()[0], self.matching_cipher)
2482
2483 def test_ciphersuite_downgrade(self):
2484 with test_wrap_socket(socket.socket(socket.AF_INET),

Callers

nothing calls this directly

Calls 6

test_wrap_socketFunction · 0.85
socketMethod · 0.80
assertRaisesRegexMethod · 0.80
connectMethod · 0.45
assertEqualMethod · 0.45
cipherMethod · 0.45

Tested by

no test coverage detected