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

Method test_connect

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

Source from the content-addressed store, hash-verified

2069 self.server_addr = (HOST, server.port)
2070
2071 def test_connect(self):
2072 with test_wrap_socket(socket.socket(socket.AF_INET),
2073 cert_reqs=ssl.CERT_NONE) as s:
2074 s.connect(self.server_addr)
2075 self.assertEqual({}, s.getpeercert())
2076 self.assertFalse(s.server_side)
2077
2078 # this should succeed because we specify the root cert
2079 with test_wrap_socket(socket.socket(socket.AF_INET),
2080 cert_reqs=ssl.CERT_REQUIRED,
2081 ca_certs=SIGNING_CA) as s:
2082 s.connect(self.server_addr)
2083 self.assertTrue(s.getpeercert())
2084 self.assertFalse(s.server_side)
2085
2086 def test_connect_fail(self):
2087 # This should fail because we have no verification certs. Connection

Callers

nothing calls this directly

Calls 7

test_wrap_socketFunction · 0.85
socketMethod · 0.80
assertFalseMethod · 0.80
assertTrueMethod · 0.80
connectMethod · 0.45
assertEqualMethod · 0.45
getpeercertMethod · 0.45

Tested by

no test coverage detected