def extract_data(file_name): file = open(file_name) email_text = file.readlines() subject = import_email.get_subject(email_text) date = import_email.get_date(email_text) body = import_email.get_content(email_text) sender_email = import_email.get_from(email_text) to_addresses = import_email.get_to(email_text) cc_addresses = import_email.get_cc(email_text) bcc_addresses = import_email.get_bcc(email_text) return { "subject": subject, "date": date, "body": body, "from": sender_email, "to": to_addresses, "cc": cc_addresses, "bcc": bcc_addresses }
def test_get_content_None(self): self.assertEqual(import_email.get_content(test_inputs.get_non_email_text()), None)
def test_get_Content(self): answer = '' answer += 'Sorry about that, here it is for real this time.\n' answer += 'Second Content Line\n' self.assertEqual(import_email.get_content(test_inputs.get_valid_email_text()), answer)