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

Method test_connect_cadata

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

Source from the content-addressed store, hash-verified

2197 self.assertTrue(cert)
2198
2199 def test_connect_cadata(self):
2200 with open(SIGNING_CA) as f:
2201 pem = f.read()
2202 der = ssl.PEM_cert_to_DER_cert(pem)
2203 ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
2204 ctx.load_verify_locations(cadata=pem)
2205 with ctx.wrap_socket(socket.socket(socket.AF_INET),
2206 server_hostname=SIGNED_CERTFILE_HOSTNAME) as s:
2207 s.connect(self.server_addr)
2208 cert = s.getpeercert()
2209 self.assertTrue(cert)
2210
2211 # same with DER
2212 ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
2213 ctx.load_verify_locations(cadata=der)
2214 with ctx.wrap_socket(socket.socket(socket.AF_INET),
2215 server_hostname=SIGNED_CERTFILE_HOSTNAME) as s:
2216 s.connect(self.server_addr)
2217 cert = s.getpeercert()
2218 self.assertTrue(cert)
2219
2220 @unittest.skipIf(os.name == "nt", "Can't use a socket as a file under Windows")
2221 def test_makefile_close(self):

Callers

nothing calls this directly

Calls 7

wrap_socketMethod · 0.95
socketMethod · 0.80
assertTrueMethod · 0.80
openFunction · 0.50
readMethod · 0.45
connectMethod · 0.45
getpeercertMethod · 0.45

Tested by

no test coverage detected