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

Fixed a typo and added test with string filepath

parent 1cecdc29
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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())
+2 −0
Original line number Diff line number Diff line
@@ -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__":