]> git.ozlabs.org Git - patchwork/commitdiff
tests/notifications: Add test for escaped patch names
authorJeremy Kerr <jk@ozlabs.org>
Tue, 1 May 2012 07:51:38 +0000 (15:51 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Tue, 1 May 2012 07:53:32 +0000 (15:53 +0800)
.. to test for the fix introduced in 18986b7e.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
apps/patchwork/tests/notifications.py

index f14b30b5c2837638c15cab88d4d55777cb770b63..df7e3f9766c16c013b164dfe42343366881c795f 100644 (file)
@@ -172,6 +172,20 @@ class PatchNotificationEmailTest(TestCase):
         self.assertEquals(msg.to, [self.submitter.email])
         self.assertTrue(self.patch.get_absolute_url() in msg.body)
 
+    def testNotificationEscaping(self):
+        self.patch.name = 'Patch name with " character'
+        self.patch.save()
+        PatchChangeNotification(patch = self.patch,
+                               orig_state = self.patch.state).save()
+        self._expireNotifications()
+
+        errors = send_notifications()
+        self.assertEquals(errors, [])
+        self.assertEquals(len(mail.outbox), 1)
+        msg = mail.outbox[0]
+        self.assertEquals(msg.to, [self.submitter.email])
+        self.assertFalse('&quot;' in msg.body)
+
     def testNotificationOptout(self):
         """ensure opt-out addresses don't get notifications"""
         PatchChangeNotification(patch = self.patch,