Loading src/common/mail.py +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ def send_email(subject, text, files=None): msg.attach(part) else: logger.error(f'Failed to attach file {f}. {f} is not a file.') elif isistance(files, str) and len(files) > 0: elif isinstance(files, str) and len(files) > 0: if os.path.isfile(files): with open(files, 'rb') as att_file: part = MIMEApplication(att_file.read()) Loading test/test.py +2 −0 Original line number Diff line number Diff line Loading @@ -145,6 +145,8 @@ class MailTestCase(unittest.TestCase): 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__": Loading Loading
src/common/mail.py +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ def send_email(subject, text, files=None): msg.attach(part) else: logger.error(f'Failed to attach file {f}. {f} is not a file.') elif isistance(files, str) and len(files) > 0: elif isinstance(files, str) and len(files) > 0: if os.path.isfile(files): with open(files, 'rb') as att_file: part = MIMEApplication(att_file.read()) Loading
test/test.py +2 −0 Original line number Diff line number Diff line Loading @@ -145,6 +145,8 @@ class MailTestCase(unittest.TestCase): 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__": Loading