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

Method test_context_custom_class

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

Source from the content-addressed store, hash-verified

1817 self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
1818
1819 def test_context_custom_class(self):
1820 class MySSLSocket(ssl.SSLSocket):
1821 pass
1822
1823 class MySSLObject(ssl.SSLObject):
1824 pass
1825
1826 ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
1827 ctx.sslsocket_class = MySSLSocket
1828 ctx.sslobject_class = MySSLObject
1829
1830 with ctx.wrap_socket(socket.socket(), server_side=True) as sock:
1831 self.assertIsInstance(sock, MySSLSocket)
1832 obj = ctx.wrap_bio(ssl.MemoryBIO(), ssl.MemoryBIO(), server_side=True)
1833 self.assertIsInstance(obj, MySSLObject)
1834
1835 def test_num_tickest(self):
1836 ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)

Callers

nothing calls this directly

Calls 4

wrap_socketMethod · 0.95
wrap_bioMethod · 0.95
socketMethod · 0.80
assertIsInstanceMethod · 0.80

Tested by

no test coverage detected