blob: 0198ab669e0b056044d8838c502bdf538b085241 [file] [log] [blame]
Benjamin Peterson90f5ba52010-03-11 22:53:45 +00001#!/usr/bin/env python3
R. David Murray87e20742009-05-23 01:30:26 +00002
3import unittest
4from test import support
5import smtplib
6
R. David Murrayeccb2ce2009-05-23 02:36:15 +00007support.requires("network")
R. David Murray87e20742009-05-23 01:30:26 +00008
9class SmtpSSLTest(unittest.TestCase):
10 testServer = 'smtp.gmail.com'
11 remotePort = 465
12
13 def test_connect(self):
R. David Murrayeccb2ce2009-05-23 02:36:15 +000014 support.get_attribute(smtplib, 'SMTP_SSL')
Antoine Pitrou6003ff72010-10-13 17:14:16 +000015 with support.transient_internet(self.testServer):
16 server = smtplib.SMTP_SSL(self.testServer, self.remotePort)
R. David Murray87e20742009-05-23 01:30:26 +000017 server.ehlo()
18 server.quit()
19
Antoine Pitrouc1d52062011-05-07 19:39:37 +020020 def test_connect_default_port(self):
21 support.get_attribute(smtplib, 'SMTP_SSL')
22 with support.transient_internet(self.testServer):
23 server = smtplib.SMTP_SSL(self.testServer)
24 server.ehlo()
25 server.quit()
26
R. David Murray87e20742009-05-23 01:30:26 +000027def test_main():
28 support.run_unittest(SmtpSSLTest)
29
30if __name__ == "__main__":
31 test_main()