fix: correct arg type

assign_to expects a list of strings of users not a single string.
This commit is contained in:
Ankush Menat 2024-01-04 15:53:59 +05:30
parent 3836d942ac
commit cc2bb85484
2 changed files with 8 additions and 4 deletions

View file

@ -294,6 +294,8 @@ class EmailAccount(Document):
error_message = _(
"Authentication failed while receiving emails from Email Account: {0}."
).format(self.name)
error_message = _("Email Account Disabled.") + " " + error_message
error_message += "<br>" + _("Message from server: {0}").format(cstr(e))
self.handle_incoming_connect_error(description=error_message)
return None
@ -489,7 +491,7 @@ class EmailAccount(Document):
state.pop("_smtp_server_instance", None)
def handle_incoming_connect_error(self, description):
if self.get_failed_attempts_count() > 2:
if self.get_failed_attempts_count() > 5:
# This is done in background to avoid committing here.
frappe.enqueue(self._disable_broken_incoming_account, description=description)
else:
@ -502,7 +504,7 @@ class EmailAccount(Document):
try:
assign_to.add(
{
"assign_to": user,
"assign_to": [user],
"doctype": self.doctype,
"name": self.name,
"description": description,

View file

@ -361,8 +361,10 @@ class TestEmailIntegrationTest(FrappeTestCase):
subject = "checking if email works"
content = "is email working?"
frappe.sendmail(sender=sender, recipients=recipients, subject=subject, content=content, now=True)
email = frappe.get_last_doc("Email Queue")
email = frappe.sendmail(
sender=sender, recipients=recipients, subject=subject, content=content, now=True
)
email.reload()
self.assertEqual(email.sender, sender)
self.assertEqual(len(email.recipients), 2)
self.assertEqual(email.status, "Sent")