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

Method test_stls_context

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

Source from the content-addressed store, hash-verified

408
409 @requires_ssl
410 def test_stls_context(self):
411 expected = b'+OK Begin TLS negotiation'
412 ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
413 ctx.load_verify_locations(CAFILE)
414 self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
415 self.assertEqual(ctx.check_hostname, True)
416 with self.assertRaises(ssl.CertificateError):
417 resp = self.client.stls(context=ctx)
418 self.client = poplib.POP3("localhost", self.server.port,
419 timeout=test_support.LOOPBACK_TIMEOUT)
420 resp = self.client.stls(context=ctx)
421 self.assertEqual(resp, expected)
422
423
424if SUPPORTS_SSL:

Callers

nothing calls this directly

Calls 4

load_verify_locationsMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45
stlsMethod · 0.45

Tested by

no test coverage detected