diff --git a/kallithea/templates/email_templates/main.html b/kallithea/templates/email_templates/main.html --- a/kallithea/templates/email_templates/main.html +++ b/kallithea/templates/email_templates/main.html @@ -1,6 +1,15 @@ + + +
+- From: u1 To: u2@example.com Subject: [Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch - --------------------- - ++
Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff: This is the new comment. @@ -26,9 +27,16 @@ This changeset did something clever whic -- This is an automatic notification. Don't reply to this mail. - ---------------------- + +
Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff:
@@ -44,24 +52,22 @@ This is an automatic notification. Don't This changeset did something clever which is hard to explain ---------------------- - + + +
- From: u1 To: u2@example.com Subject: [Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch - --------------------- - ++
Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff mentioned you: This is the new comment. @@ -78,9 +84,16 @@ This changeset did something clever whic -- This is an automatic notification. Don't reply to this mail. - ---------------------- + +
Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff mentioned you:
@@ -96,24 +109,22 @@ This is an automatic notification. Don't This changeset did something clever which is hard to explain ---------------------- - + + +
- From: u1 To: u2@example.com Subject: [Approved: Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch - --------------------- - ++
Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff: This is the new comment. @@ -131,9 +142,16 @@ This changeset did something clever whic -- This is an automatic notification. Don't reply to this mail. - ---------------------- + +
Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff:
@@ -150,24 +168,22 @@ This is an automatic notification. Don't This changeset did something clever which is hard to explain ---------------------- - + + +
- From: u1 To: u2@example.com Subject: [Approved: Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch - --------------------- - ++
Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff mentioned you: This is the new comment. @@ -185,9 +201,16 @@ This changeset did something clever whic -- This is an automatic notification. Don't reply to this mail. - ---------------------- + +
Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff mentioned you:
@@ -204,24 +227,22 @@ This is an automatic notification. Don't This changeset did something clever which is hard to explain ---------------------- - + + +
- From: u1 To: u2@example.com Subject: Test Message - --------------------- - ++
This is the body of the test message - nothing interesting here except indentation. @@ -229,32 +250,37 @@ This is the body of the test message -- This is an automatic notification. Don't reply to this mail. - ---------------------- + +
--------------------- - + + +
- From: u1 To: u2@example.com Subject: New user newbie registered - --------------------- - ++
Registration body @@ -263,33 +289,38 @@ View this user here: http://newbie.org -- This is an automatic notification. Don't reply to this mail. - ---------------------- + +
--------------------- - + + +
- From: u1 To: u2@example.com Subject: [Review] repo/name PR #7 "The Title" from devbranch by u2 - --------------------- - ++
Requesting User (root) requested your review of repo/name pull request "The Title" @@ -312,9 +343,16 @@ Make one plus two equal tree -- This is an automatic notification. Don't reply to this mail. - ---------------------- + +
Requesting User (root) requested your review of repo/name pull request "The Title"
@@ -337,24 +375,22 @@ Make one plus two equal tree ---------------------- - + + +
- From: u1 To: u2@example.com Subject: [Review] repo/name PR #7 "The Title" from devbranch by u2 - --------------------- - ++
Requesting User (root) mentioned you on repo/name pull request "The Title" @@ -377,9 +413,16 @@ Make one plus two equal tree -- This is an automatic notification. Don't reply to this mail. - ---------------------- + +
Requesting User (root) mentioned you on repo/name pull request "The Title"
@@ -402,24 +445,22 @@ Make one plus two equal tree ---------------------- - + + +
- From: u1 To: u2@example.com Subject: [Comment] repo/name PR #7 "The Title" from devbranch by u2 - --------------------- - ++
Comment from Opinionated User (jsmith) on repo/name pull request "The Title": Me too! @@ -432,9 +473,16 @@ URL: http://pr.org/comment -- This is an automatic notification. Don't reply to this mail. - ---------------------- + +
Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
@@ -445,24 +493,22 @@ This is an automatic notification. Don't ---------------------- - + + +
- From: u1 To: u2@example.com Subject: [Comment] repo/name PR #7 "The Title" from devbranch by u2 - --------------------- - ++
Comment from Opinionated User (jsmith) on repo/name pull request "The Title": Me too! @@ -475,9 +521,16 @@ URL: http://pr.org/comment -- This is an automatic notification. Don't reply to this mail. - ---------------------- + +
Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
@@ -488,24 +541,22 @@ This is an automatic notification. Don't ---------------------- - + + +
- From: u1 To: u2@example.com Subject: [Under Review: Comment] repo/name PR #7 "The Title" from devbranch by u2 - --------------------- - ++
Comment from Opinionated User (jsmith) on repo/name pull request "The Title": Me too! @@ -519,9 +570,16 @@ URL: http://pr.org/comment -- This is an automatic notification. Don't reply to this mail. - ---------------------- + +
Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
@@ -533,24 +591,22 @@ This is an automatic notification. Don't ---------------------- - + + +
- From: u1 To: u2@example.com Subject: [Under Review: Comment] repo/name PR #7 "The Title" from devbranch by u2 - --------------------- - ++
Comment from Opinionated User (jsmith) on repo/name pull request "The Title": Me too! @@ -564,9 +620,16 @@ URL: http://pr.org/comment -- This is an automatic notification. Don't reply to this mail. - ---------------------- + +
Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
@@ -578,24 +641,22 @@ This is an automatic notification. Don't ---------------------- - + + +
- From: u1 To: u2@example.com Subject: [Closing: Comment] repo/name PR #7 "The Title" from devbranch by u2 - --------------------- - ++
Comment from Opinionated User (jsmith) on repo/name pull request "The Title": Me too! @@ -608,9 +669,16 @@ URL: http://pr.org/comment -- This is an automatic notification. Don't reply to this mail. - ---------------------- + +
Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
@@ -621,24 +689,22 @@ This is an automatic notification. Don't ---------------------- - + + +
- From: u1 To: u2@example.com Subject: [Closing: Comment] repo/name PR #7 "The Title" from devbranch by u2 - --------------------- - ++
Comment from Opinionated User (jsmith) on repo/name pull request "The Title": Me too! @@ -651,9 +717,16 @@ URL: http://pr.org/comment -- This is an automatic notification. Don't reply to this mail. - ---------------------- + +
Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
@@ -664,24 +737,22 @@ This is an automatic notification. Don't ---------------------- - + + +
- From: u1 To: u2@example.com Subject: [Under Review, Closing: Comment] repo/name PR #7 "The Title" from devbranch by u2 - --------------------- - ++
Comment from Opinionated User (jsmith) on repo/name pull request "The Title": Me too! @@ -695,9 +766,16 @@ URL: http://pr.org/comment -- This is an automatic notification. Don't reply to this mail. - ---------------------- + +
Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
@@ -709,24 +787,22 @@ This is an automatic notification. Don't ---------------------- - + + +
- From: u1 To: u2@example.com Subject: [Under Review, Closing: Comment] repo/name PR #7 "The Title" from devbranch by u2 - --------------------- - ++
Comment from Opinionated User (jsmith) on repo/name pull request "The Title": Me too! @@ -740,9 +816,16 @@ URL: http://pr.org/comment -- This is an automatic notification. Don't reply to this mail. - ---------------------- + +
Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
@@ -754,24 +837,22 @@ This is an automatic notification. Don't ---------------------- - + + +
- From: u1 To: john@doe.com Subject: Password reset link - --------------------- - ++
Hello John Doe @@ -787,9 +868,16 @@ If it weren't you who requested the pass -- This is an automatic notification. Don't reply to this mail. - ---------------------- + +
If it weren't you who requested the password reset, just disregard this message.
---------------------- - + + 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 @@ -1,4 +1,5 @@ import os +import re import mock import routes.util @@ -170,17 +171,19 @@ class TestNotifications(TestController): l = [] def send_email(recipients, subject, body='', html_body='', headers=None, author=None): - l.append('\n\n
\n\n')
+ 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('To: %s\n' % ' '.join(recipients))
l.append('Subject: %s\n' % subject)
- l.append('\n--------------------\n%s\n--------------------' % body)
l.append('\n')
- l.append('\n%s\n' % html_body)
- l.append('--------------------
\n')
+ l.append('
\n')
+ l.append('%s
\n' % body)
+ l.append('
\n')
+ l.append(html_body)
+ l.append('
\n')
- l.append('\n')
with mock.patch.object(kallithea.lib.celerylib.tasks, 'send_email', send_email):
pr_kwargs = dict(
pr_nice_id='#7',
@@ -268,8 +271,8 @@ class TestNotifications(TestController):
EmailNotificationModel().get_email_tmpl(EmailNotificationModel.TYPE_PASSWORD_RESET, 'html', **kwargs),
author=User.get(self.u1))
- l.append('\n\n')
- out = ''.join(l)
+ out = '\n\nNotifications \n\n%s\n\n\n' % \
+ re.sub(r'<(/?(?:!doctype|html|head|title|meta|body)\b[^>]*)>', r'', ''.join(l))
outfn = os.path.join(os.path.dirname(__file__), 'test_dump_html_mails.out.html')
reffn = os.path.join(os.path.dirname(__file__), 'test_dump_html_mails.ref.html')