diff --git a/kallithea/tests/models/test_notifications.py b/kallithea/tests/models/test_notifications.py --- a/kallithea/tests/models/test_notifications.py +++ b/kallithea/tests/models/test_notifications.py @@ -43,12 +43,12 @@ class TestNotifications(base.TestControl with test_context(self.app): usrs = [self.u1, self.u2] - def send_email(recipients, subject, body='', html_body='', headers=None, author=None): + def send_email(recipients, subject, body='', html_body='', headers=None, from_name=None): assert recipients == ['u2@example.com'] assert subject == 'Test Message' assert body == "hi there" assert '>hi there<' in html_body - assert author.username == 'u1' + assert from_name == 'u1 u1' with mock.patch.object(kallithea.lib.celerylib.tasks, 'send_email', send_email): NotificationModel().create(created_by=self.u1, subject='subj', body='hi there', @@ -59,11 +59,11 @@ class TestNotifications(base.TestControl # Exercise all notification types and dump them to one big html file l = [] - def send_email(recipients, subject, body='', html_body='', headers=None, author=None): + def send_email(recipients, subject, body='', html_body='', headers=None, from_name=None): l.append('
\n') l.append('

%s

\n' % desc) # desc is from outer scope l.append('
\n')
-            l.append('From: %s\n' % author.username)
+            l.append('From: %s \n' % from_name)
             l.append('To: %s\n' % ' '.join(recipients))
             l.append('Subject: %s\n' % subject)
             l.append('
\n') @@ -159,7 +159,7 @@ class TestNotifications(base.TestControl "Password reset link", EmailNotificationModel().get_email_tmpl(EmailNotificationModel.TYPE_PASSWORD_RESET, 'txt', **kwargs), EmailNotificationModel().get_email_tmpl(EmailNotificationModel.TYPE_PASSWORD_RESET, 'html', **kwargs), - author=User.get(self.u1)) + from_name=User.get(self.u1).full_name_or_username) out = '\n\nNotifications\n\n%s\n\n\n' % \ re.sub(r'<(/?(?:!doctype|html|head|title|meta|body)\b[^>]*)>', r'', ''.join(l))