Commits

jordilin committed 8091f13

mail test case

  • Participants
  • Parent commits 3239ccb

Comments (0)

Files changed (2)

File log4client/src/log4tailer/notifications.py

                  'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
 
     def __init__(self, fro = None, to = None, hostname = None, user = None,
-            passwd = None, port = 25, ssl = "False"):
+            passwd = None, port = 25, ssl = False):
         self.fro = fro
         self.to = to
         self.hostname = hostname
         self.port = port
         self.ssl = ssl
         self.connection_method = "smtp"
-        if self.ssl == "True":
+        if self.ssl:
             self.connection_method = "smtp_ssl"
 
     def date_time(self):
                 self.count = 0
                 self.flagged = False
 
+
 class WaitForever(object):
     def __init__(self):
         self.forever = True

File log4client/tests/test_mailaction.py

     def tearDown(self):
         self.mocker.restore()
         self.mocker.verify()
+
+
+class MailTestCase(unittest.TestCase):
+
+    def test_instantiates(self):
+        mail = notifications.Mail()
+        self.assertTrue(isinstance(mail, notifications.Mail))
+
+    def test_is_ssl(self):
+        mail = notifications.Mail(ssl=True)
+        self.assertEqual(mail.connection_method, "smtp_ssl")
+
+    def test_is_not_ssl(self):
+        mail = notifications.Mail()
+        self.assertEqual(mail.connection_method, "smtp")