diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2011-04-14 19:37:55 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2011-04-14 19:37:55 +0800 |
commit | f1e5f6a2c9d737f12290f5bd5a934b74c362616f (patch) | |
tree | 5917844b4f15870e9a0015f2ebd1d928190bf9cb /apps/patchwork/tests/notifications.py | |
parent | 017f73b059aadfce30ee29d2aceeab92739105a6 (diff) | |
download | patchwork-f1e5f6a2c9d737f12290f5bd5a934b74c362616f.tar.bz2 patchwork-f1e5f6a2c9d737f12290f5bd5a934b74c362616f.tar.xz |
notifications: implement opt-outnotifications
Check for opt-out status before sending notification mail.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'apps/patchwork/tests/notifications.py')
-rw-r--r-- | apps/patchwork/tests/notifications.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/patchwork/tests/notifications.py b/apps/patchwork/tests/notifications.py index ae37988..f14b30b 100644 --- a/apps/patchwork/tests/notifications.py +++ b/apps/patchwork/tests/notifications.py @@ -23,7 +23,7 @@ from django.core.urlresolvers import reverse from django.core import mail from django.conf import settings from django.db.utils import IntegrityError -from patchwork.models import Patch, State, PatchChangeNotification +from patchwork.models import Patch, State, PatchChangeNotification, EmailOptout from patchwork.tests.utils import defaults, create_maintainer from patchwork.utils import send_notifications @@ -172,6 +172,18 @@ class PatchNotificationEmailTest(TestCase): self.assertEquals(msg.to, [self.submitter.email]) self.assertTrue(self.patch.get_absolute_url() in msg.body) + def testNotificationOptout(self): + """ensure opt-out addresses don't get notifications""" + PatchChangeNotification(patch = self.patch, + orig_state = self.patch.state).save() + self._expireNotifications() + + EmailOptout(email = self.submitter.email).save() + + errors = send_notifications() + self.assertEquals(errors, []) + self.assertEquals(len(mail.outbox), 0) + def testNotificationMerge(self): patches = [self.patch, Patch(project = self.project, msgid = 'testpatch-2', |