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

Method test_no_shared_ciphers

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

Source from the content-addressed store, hash-verified

4147 self.assertEqual(cm.exception.errno, errno.ENOTCONN)
4148
4149 def test_no_shared_ciphers(self):
4150 client_context, server_context, hostname = testing_context()
4151 # OpenSSL enables all TLS 1.3 ciphers, enforce TLS 1.2 for test
4152 client_context.maximum_version = ssl.TLSVersion.TLSv1_2
4153 # Force different suites on client and server
4154 client_context.set_ciphers("AES128")
4155 server_context.set_ciphers("AES256")
4156 with ThreadedEchoServer(context=server_context) as server:
4157 with client_context.wrap_socket(socket.socket(),
4158 server_hostname=hostname) as s:
4159 with self.assertRaises(OSError):
4160 s.connect((HOST, server.port))
4161 self.assertIn("NO_SHARED_CIPHER", server.conn_errors[0])
4162 self.assertIsNone(s.cipher())
4163 self.assertIsNone(s.group())
4164
4165 def test_version_basic(self):
4166 """

Callers

nothing calls this directly

Calls 10

testing_contextFunction · 0.85
ThreadedEchoServerClass · 0.85
wrap_socketMethod · 0.80
socketMethod · 0.80
assertInMethod · 0.80
assertIsNoneMethod · 0.80
assertRaisesMethod · 0.45
connectMethod · 0.45
cipherMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected