def test_incoming_with_attach(self):
        frappe.db.sql(
            "delete from tabCommunication where sender='*****@*****.**'"
        )
        existing_file = frappe.get_doc({
            'doctype': 'File Data',
            'file_name': 'erpnext-conf-14.png'
        })
        frappe.delete_doc("File Data", existing_file.name)
        delete_file_from_filesystem(existing_file)

        with open(
                os.path.join(os.path.dirname(__file__), "test_mails",
                             "incoming-2.raw"), "r") as f:
            test_mails = [f.read()]

        email_account = frappe.get_doc("Email Account",
                                       "_Test Email Account 1")
        email_account.receive(test_mails=test_mails)

        comm = frappe.get_doc("Communication",
                              {"sender": "*****@*****.**"})
        self.assertTrue("*****@*****.**" in comm.recipients)

        # check attachment
        attachments = get_attachments(comm.doctype, comm.name)
        self.assertTrue(
            "erpnext-conf-14.png" in [f.file_name for f in attachments])
	def test_incoming_with_attach(self):
		frappe.db.sql("delete from tabCommunication where sender='*****@*****.**'")
		existing_file = frappe.get_doc({'doctype': 'File Data', 'file_name': 'erpnext-conf-14.png'})
		frappe.delete_doc("File Data", existing_file.name)
		delete_file_from_filesystem(existing_file)

		with open(os.path.join(os.path.dirname(__file__), "test_mails", "incoming-2.raw"), "r") as f:
			test_mails = [f.read()]

		email_account = frappe.get_doc("Email Account", "_Test Email Account 1")
		email_account.receive(test_mails=test_mails)

		comm = frappe.get_doc("Communication", {"sender": "*****@*****.**"})
		self.assertTrue("*****@*****.**" in comm.recipients)

		# check attachment
		attachments = get_attachments(comm.doctype, comm.name)
		self.assertTrue("erpnext-conf-14.png" in [f.file_name for f in attachments])