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

Method test_connect_starttls

Lib/test/test_smtpnet.py:31–46  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

29 remotePort = 587
30
31 def test_connect_starttls(self):
32 support.get_attribute(smtplib, 'SMTP_SSL')
33 context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
34 context.check_hostname = False
35 context.verify_mode = ssl.CERT_NONE
36 with socket_helper.transient_internet(self.testServer):
37 server = smtplib.SMTP(self.testServer, self.remotePort)
38 try:
39 server.starttls(context=context)
40 except smtplib.SMTPException as e:
41 if e.args[0] == 'STARTTLS extension not supported by server.':
42 unittest.skip(e.args[0])
43 else:
44 raise
45 server.ehlo()
46 server.quit()
47
48
49class SmtpSSLTest(unittest.TestCase):

Callers

nothing calls this directly

Calls 4

starttlsMethod · 0.95
ehloMethod · 0.95
quitMethod · 0.95
skipMethod · 0.80

Tested by

no test coverage detected