1import unittest 2from test import test_support 3import smtplib 4 5test_support.requires("network") 6 7class SmtpSSLTest(unittest.TestCase): 8 testServer = 'smtp.gmail.com' 9 remotePort = 465 10 11 def test_connect(self): 12 test_support.get_attribute(smtplib, 'SMTP_SSL') 13 with test_support.transient_internet(self.testServer): 14 server = smtplib.SMTP_SSL(self.testServer, self.remotePort) 15 server.ehlo() 16 server.quit() 17 18 def test_connect_default_port(self): 19 test_support.get_attribute(smtplib, 'SMTP_SSL') 20 with test_support.transient_internet(self.testServer): 21 server = smtplib.SMTP_SSL(self.testServer) 22 server.ehlo() 23 server.quit() 24 25def test_main(): 26 test_support.run_unittest(SmtpSSLTest) 27 28if __name__ == "__main__": 29 test_main() 30