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

Method test_connect_capath

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

Source from the content-addressed store, hash-verified

1957 s.connect, self.server_addr)
1958
1959 def test_connect_capath(self):
1960 # Verify server certificates using the `capath` argument
1961 # NOTE: the subject hashing algorithm has been changed between
1962 # OpenSSL 0.9.8n and 1.0.0, as a result the capath directory must
1963 # contain both versions of each certificate (same content, different
1964 # filename) for this test to be portable across OpenSSL releases.
1965 ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
1966 ctx.load_verify_locations(capath=CAPATH)
1967 with ctx.wrap_socket(socket.socket(socket.AF_INET),
1968 server_hostname=SIGNED_CERTFILE_HOSTNAME) as s:
1969 s.connect(self.server_addr)
1970 cert = s.getpeercert()
1971 self.assertTrue(cert)
1972
1973 # Same with a bytes `capath` argument
1974 ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
1975 ctx.load_verify_locations(capath=BYTES_CAPATH)
1976 with ctx.wrap_socket(socket.socket(socket.AF_INET),
1977 server_hostname=SIGNED_CERTFILE_HOSTNAME) as s:
1978 s.connect(self.server_addr)
1979 cert = s.getpeercert()
1980 self.assertTrue(cert)
1981
1982 def test_connect_cadata(self):
1983 with open(SIGNING_CA) as f:

Callers

nothing calls this directly

Calls 6

wrap_socketMethod · 0.95
socketMethod · 0.80
assertTrueMethod · 0.80
load_verify_locationsMethod · 0.45
connectMethod · 0.45
getpeercertMethod · 0.45

Tested by

no test coverage detected