Commit ec6dd773 authored by Hamaker, Alec's avatar Hamaker, Alec
Browse files

uncommented email tests

parent d4398531
Loading
Loading
Loading
Loading
+26 −25
Original line number Diff line number Diff line
@@ -267,31 +267,32 @@ class LogzTestCase(unittest.TestCase):
        plm.write_log_collection_to_database()


# class MailTestCase(unittest.TestCase):
#     """MailTestCase."""
# 
#     def test_send_email(self):
#         """Test to make sure that then send_mail function can actually send
#         mail"""
#         send_email("TEST SUBJECT", "THIS IS A TEST MESSAGE")
# 
#     def test_send_email_attachment(self):
#         """Test to make sure that we can send attachments.."""
#         ATTACHMENT_PATHS = ["/test/test_attachments/test_attachment.txt",
#                             "/test/test_attachments/test_attachment2.txt"]
#         ATTACHMENT_PATHS_W_BAD_FILE = [
#             "/test/test_attachments/test_attachment.txt",
#             "/this/is/not/a/real/file/path.txt"]
#         send_email(
#             "TEST SUBJECT WITH ATTACHMENT", "THIS IS A TEST MESSAGE",
#             files=[ATTACHMENT_PATHS[0]]
#         )
#         send_email("TEST SUBJECT MULTI-ATTACHMENTS", "TEST MESSAGE",
#                    files=ATTACHMENT_PATHS)
#         send_email("TEST SUBJECT WITH BAD PATH", "TEST MESSAGE",
#                    files=ATTACHMENT_PATHS_W_BAD_FILE)
#         send_email("TEST SUBJECT WITH STRING FILE PATH", "TEST MESSAGE",
#                    files=ATTACHMENT_PATHS[0])
class MailTestCase(unittest.TestCase):
    """MailTestCase."""

    def test_send_email(self):
        """Test to make sure that then send_mail function can actually send
        mail"""
        send_email("TEST SUBJECT", "THIS IS A TEST MESSAGE")

    def test_send_email_attachment(self):
        """Test to make sure that we can send attachments.."""
        ATTACHMENT_PATHS = ["/test/test_attachments/test_attachment.txt",
                            "/test/test_attachments/test_attachment2.txt"]
        ATTACHMENT_PATHS_W_BAD_FILE = [
            "/test/test_attachments/test_attachment.txt",
            "/this/is/not/a/real/file/path.txt"]
        send_email(
            "TEST SUBJECT WITH ATTACHMENT", "THIS IS A TEST MESSAGE",
            files=[ATTACHMENT_PATHS[0]]
        )
        send_email("TEST SUBJECT MULTI-ATTACHMENTS", "TEST MESSAGE",
                   files=ATTACHMENT_PATHS)
        send_email("TEST SUBJECT WITH BAD PATH", "TEST MESSAGE",
                   files=ATTACHMENT_PATHS_W_BAD_FILE)
        send_email("TEST SUBJECT WITH STRING FILE PATH", "TEST MESSAGE",
                   files=ATTACHMENT_PATHS[0])


if __name__ == "__main__":
    unittest.main(verbosity=2)