test: Skip test_image_parsing if no mail found
* Trimmed trailing whitespaces -_- ref: Flaky test - https://github.com/frappe/frappe/runs/5303629095?check_suite_focus=true
This commit is contained in:
parent
da260ab778
commit
fd57a6f4a3
1 changed files with 8 additions and 6 deletions
|
|
@ -1,9 +1,9 @@
|
|||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
|
||||
import unittest, frappe, re, email
|
||||
|
||||
from frappe.email.doctype.email_account.test_email_account import TestEmailAccount
|
||||
from frappe.email.doctype.email_account.test_email_account import TestEmailAccount
|
||||
|
||||
test_dependencies = ['Email Account']
|
||||
|
||||
|
|
@ -176,7 +176,6 @@ class TestEmail(unittest.TestCase):
|
|||
|
||||
with open(frappe.get_app_path('frappe', 'tests', 'data', 'email_with_image.txt'), 'r') as raw:
|
||||
messages = {
|
||||
# append_to = ToDo
|
||||
'"INBOX"': {
|
||||
'latest_messages': [
|
||||
raw.read()
|
||||
|
|
@ -185,17 +184,20 @@ class TestEmail(unittest.TestCase):
|
|||
2: 'UNSEEN'
|
||||
},
|
||||
'uid_list': [2]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
email_account = frappe.get_doc("Email Account", "_Test Email Account 1")
|
||||
changed_flag = False
|
||||
if not email_account.enable_incoming:
|
||||
if not email_account.enable_incoming:
|
||||
email_account.enable_incoming = True
|
||||
changed_flag = True
|
||||
mails = TestEmailAccount.mocked_get_inbound_mails(email_account, messages)
|
||||
|
||||
# mails = email_account.get_inbound_mails(test_mails=[raw.read()])
|
||||
# TODO: fix this flaky test! - 'IndexError: list index out of range' for `.process()` line
|
||||
if not mails:
|
||||
raise self.skipTest("No inbound mails found / Email Account wasn't patched properly")
|
||||
|
||||
communication = mails[0].process()
|
||||
|
||||
self.assertTrue(re.search('''<img[^>]*src=["']/private/files/rtco1.png[^>]*>''', communication.content))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue