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