Home | History | Annotate | Download | only in test
      1 import unittest
      2 from test import test_support
      3 import smtplib
      4 
      5 test_support.requires("network")
      6 
      7 class 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 
     25 def test_main():
     26     test_support.run_unittest(SmtpSSLTest)
     27 
     28 if __name__ == "__main__":
     29     test_main()
     30