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

Method test_context_setget

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

Source from the content-addressed store, hash-verified

2105 self.assertEqual(len(ctx.get_ca_certs()), 1)
2106
2107 def test_context_setget(self):
2108 # Check that the context of a connected socket can be replaced.
2109 ctx1 = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
2110 ctx1.load_verify_locations(capath=CAPATH)
2111 ctx2 = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
2112 ctx2.load_verify_locations(capath=CAPATH)
2113 s = socket.socket(socket.AF_INET)
2114 with ctx1.wrap_socket(s, server_hostname='localhost') as ss:
2115 ss.connect(self.server_addr)
2116 self.assertIs(ss.context, ctx1)
2117 self.assertIs(ss._sslobj.context, ctx1)
2118 ss.context = ctx2
2119 self.assertIs(ss.context, ctx2)
2120 self.assertIs(ss._sslobj.context, ctx2)
2121
2122 def ssl_io_loop(self, sock, incoming, outgoing, func, *args, **kwargs):
2123 # A simple IO loop. Call func(*args) depending on the error we get

Callers

nothing calls this directly

Calls 5

wrap_socketMethod · 0.95
socketMethod · 0.80
load_verify_locationsMethod · 0.45
connectMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected