launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #11685
[Merge] lp:~stevenk/launchpad/remove-registrant-tests into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/remove-registrant-tests into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/remove-registrant-tests/+merge/123207
Kill a test class full of registrant tests that no longer hold true.
--
https://code.launchpad.net/~stevenk/launchpad/remove-registrant-tests/+merge/123207
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/remove-registrant-tests into lp:launchpad.
=== modified file 'lib/lp/bugs/tests/test_bugnotification.py'
--- lib/lp/bugs/tests/test_bugnotification.py 2012-08-08 11:48:29 +0000
+++ lib/lp/bugs/tests/test_bugnotification.py 2012-09-07 02:16:22 +0000
@@ -6,13 +6,11 @@
__metaclass__ = type
from datetime import datetime
-from itertools import chain
from lazr.lifecycle.event import ObjectModifiedEvent
from lazr.lifecycle.snapshot import Snapshot
import pytz
from storm.store import Store
-from testtools.matchers import Not
import transaction
from zope.component import getUtility
from zope.event import notify
@@ -43,7 +41,6 @@
DatabaseFunctionalLayer,
LaunchpadZopelessLayer,
)
-from lp.testing.matchers import Contains
class TestNotificationsSentForBugExpiration(TestCaseWithFactory):
@@ -418,67 +415,6 @@
self.assertEqual(self.dupe_subscribers, recipients)
-class NotificationForRegistrantsMixin:
- """Mixin for testing when registrants get notified."""
-
- layer = DatabaseFunctionalLayer
-
- def setUp(self):
- super(NotificationForRegistrantsMixin, self).setUp(
- user='foo.bar@xxxxxxxxxxxxx')
- self.pillar_owner = self.factory.makePerson(name="distro-owner")
- self.bug_owner = self.factory.makePerson(name="bug-owner")
- self.pillar = self.makePillar()
- self.bug = self.factory.makeBug(
- target=self.pillar, owner=self.bug_owner)
-
- def test_notification_does_not_use_malone(self):
- self.pillar.official_malone = False
- direct = self.bug.getDirectSubscribers()
- indirect = self.bug.getIndirectSubscribers()
- self.assertThat(direct, Not(Contains(self.pillar_owner)))
- self.assertThat(indirect, Not(Contains(self.pillar_owner)))
-
- def test_status_change_does_not_use_malone(self):
- # Status changes are sent to the direct and indirect subscribers.
- self.pillar.official_malone = False
- [bugtask] = self.bug.bugtasks
- all_subscribers = set(
- [person.name for person in chain(
- self.bug.getDirectSubscribers(),
- self.bug.getIndirectSubscribers())])
- bugtask_before_modification = Snapshot(
- bugtask, providing=providedBy(bugtask))
- bugtask.transitionToStatus(
- BugTaskStatus.INVALID, self.bug.owner)
- notify(ObjectModifiedEvent(
- bugtask, bugtask_before_modification, ['status'],
- user=self.bug.owner))
- latest_notification = BugNotification.selectFirst(orderBy='-id')
- notified_people = set(
- recipient.person.name
- for recipient in latest_notification.recipients)
- self.assertEqual(all_subscribers, notified_people)
- self.assertThat(
- all_subscribers, Not(Contains(self.pillar_owner.name)))
-
-
-class TestNotificationsForRegistrantsForDistros(
- NotificationForRegistrantsMixin, TestCaseWithFactory):
- """Test when distribution registrants get notified."""
-
- def makePillar(self):
- return self.factory.makeDistribution(owner=self.pillar_owner)
-
-
-class TestNotificationsForRegistrantsForProducts(
- NotificationForRegistrantsMixin, TestCaseWithFactory):
- """Test when product registrants get notified."""
-
- def makePillar(self):
- return self.factory.makeProduct(owner=self.pillar_owner)
-
-
class TestBug778847(TestCaseWithFactory):
"""Regression tests for bug 778847."""
Follow ups