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

Method test_stls_context

Lib/test/test_poplib.py:418–429  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

416
417 @requires_ssl
418 def test_stls_context(self):
419 expected = b'+OK Begin TLS negotiation'
420 ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
421 ctx.load_verify_locations(CAFILE)
422 self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
423 self.assertEqual(ctx.check_hostname, True)
424 with self.assertRaises(ssl.CertificateError):
425 resp = self.client.stls(context=ctx)
426 self.client = poplib.POP3("localhost", self.server.port,
427 timeout=test_support.LOOPBACK_TIMEOUT)
428 resp = self.client.stls(context=ctx)
429 self.assertEqual(resp, expected)
430
431
432if SUPPORTS_SSL:

Callers

nothing calls this directly

Calls 3

assertEqualMethod · 0.45
assertRaisesMethod · 0.45
stlsMethod · 0.45

Tested by

no test coverage detected