launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #19165
[Merge] lp:~cjwatson/launchpad/bug-footer-newline into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/bug-footer-newline into lp:launchpad.
Commit message:
Make sure that bug notification bodies end with a single newline (before any expanded footer).
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/bug-footer-newline/+merge/266881
This is a minor point that I noticed while doing QA on https://code.launchpad.net/~cjwatson/launchpad/bug-footer/+merge/266577: there's a missing newline before the expanded notification footer, somewhat like https://code.launchpad.net/~cjwatson/launchpad/codereviewcomment-mail-newline/+merge/266846.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/bug-footer-newline into lp:launchpad.
=== modified file 'lib/lp/bugs/scripts/bugnotification.py'
--- lib/lp/bugs/scripts/bugnotification.py 2015-07-31 14:46:31 +0000
+++ lib/lp/bugs/scripts/bugnotification.py 2015-08-04 14:15:52 +0000
@@ -237,7 +237,7 @@
email_template = 'bug-notification.txt'
body_template = get_email_template(email_template, 'bugs')
- body = (body_template % body_data).strip()
+ body = (body_template % body_data).strip() + "\n"
msg = bug_notification_builder.build(
from_address, email_person, body, subject, email_date,
rationale, references, msgid, filters=data['filter descriptions'])
=== modified file 'lib/lp/bugs/scripts/tests/test_bugnotification.py'
--- lib/lp/bugs/scripts/tests/test_bugnotification.py 2015-07-08 16:05:11 +0000
+++ lib/lp/bugs/scripts/tests/test_bugnotification.py 2015-08-04 14:15:52 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for construction bug notification emails for sending."""
@@ -15,7 +15,10 @@
import pytz
from storm.store import Store
-from testtools.matchers import Not
+from testtools.matchers import (
+ MatchesRegex,
+ Not,
+ )
from transaction import commit
from zope.component import (
getSiteManager,
@@ -80,6 +83,7 @@
from lp.services.propertycache import cachedproperty
from lp.testing import (
login,
+ person_logged_in,
TestCase,
TestCaseWithFactory,
)
@@ -1209,7 +1213,7 @@
self.assertTrue(notifications.is_empty())
-class TestManageNotificationsMessage(TestCaseWithFactory):
+class TestManageNotificationsMessage(EmailNotificationTestBase):
layer = LaunchpadZopelessLayer
@@ -1245,6 +1249,30 @@
self.assertTrue(re.search('^-- $', template, re.MULTILINE))
+class TestExpandedNotificationFooters(EmailNotificationTestBase):
+
+ layer = LaunchpadZopelessLayer
+
+ def test_expanded_footer(self):
+ # Recipients with expanded_notification_footers receive an expanded
+ # footer on messages, which is separated by the correct number of
+ # newlines.
+ with lp_dbuser(), person_logged_in(self.bug_subscriber):
+ self.bug_subscriber.expanded_notification_footers = True
+ expected_to = str(self.bug_subscriber.preferredemail.email)
+ self.bug.addChange(BugTitleChange(
+ self.ten_minutes_ago, self.person, "title",
+ "Old summary", "New summary"))
+ [payload] = [
+ payload for message, payload in self.get_messages()
+ if message["to"] == expected_to]
+ self.assertThat(payload, MatchesRegex(
+ r'.*To manage notifications about this bug go to:\n'
+ r'http://.*\+subscriptions\n'
+ r'\n'
+ r'Launchpad-Notification-Type: bug\n', re.S))
+
+
class TestDeferredNotifications(TestCaseWithFactory):
layer = LaunchpadZopelessLayer
Follow ups