1. jordilin
  2. alerta

Commits

jordilin  committed 9145de3

test smtp factory

  • Participants
  • Parent commits f2d634d
  • Branches default

Comments (0)

Files changed (1)

File log4client/tests/test_mailaction.py

View file
 from log4tailer import notifications
 from log4tailer import utils
 from .utils import PropertiesStub
+from smtplib import SMTP, SMTP_SSL
 
 
 version_info = sys.version_info
         return SMTPStubRaise
 
 
+class SMPTFactoryTestCase(unittest.TestCase):
+
+    def test_smtpssl(self):
+        factory = notifications.SMTPFactory(ssl=True)
+        conn_type = factory.connection_type()
+        self.assertEqual(conn_type, SMTP_SSL)
+
+    def test_smtp_nossl(self):
+        factory = notifications.SMTPFactory(ssl=False)
+        conn_type = factory.connection_type()
+        self.assertEqual(conn_type, SMTP)
+
+
 class MailTestCase(unittest.TestCase):
 
     def test_instantiates(self):