Merge lp:~stevenk/launchpad/remove-registrant-tests into lp:launchpad

Proposed by Steve Kowalik on 2012-09-07
Status: Merged
Approved by: Steve Kowalik on 2012-09-07
Approved revision: no longer in the source branch.
Merged at revision: 15918
Proposed branch: lp:~stevenk/launchpad/remove-registrant-tests
Merge into: lp:launchpad
Diff against target: 92 lines (+0/-64)
1 file modified
lib/lp/bugs/tests/test_bugnotification.py (+0/-64)
To merge this branch: bzr merge lp:~stevenk/launchpad/remove-registrant-tests
Reviewer Review Type Date Requested Status
Ian Booth (community) 2012-09-07 Approve on 2012-09-07
Review via email: mp+123207@code.launchpad.net

Commit Message

Kill a test class full of registrant tests that no longer hold true.

Description of the Change

Kill a test class full of registrant tests that no longer hold true.

To post a comment you must log in.
Ian Booth (wallyworld) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/tests/test_bugnotification.py'
2--- lib/lp/bugs/tests/test_bugnotification.py 2012-08-08 11:48:29 +0000
3+++ lib/lp/bugs/tests/test_bugnotification.py 2012-09-07 02:16:22 +0000
4@@ -6,13 +6,11 @@
5 __metaclass__ = type
6
7 from datetime import datetime
8-from itertools import chain
9
10 from lazr.lifecycle.event import ObjectModifiedEvent
11 from lazr.lifecycle.snapshot import Snapshot
12 import pytz
13 from storm.store import Store
14-from testtools.matchers import Not
15 import transaction
16 from zope.component import getUtility
17 from zope.event import notify
18@@ -43,7 +41,6 @@
19 DatabaseFunctionalLayer,
20 LaunchpadZopelessLayer,
21 )
22-from lp.testing.matchers import Contains
23
24
25 class TestNotificationsSentForBugExpiration(TestCaseWithFactory):
26@@ -418,67 +415,6 @@
27 self.assertEqual(self.dupe_subscribers, recipients)
28
29
30-class NotificationForRegistrantsMixin:
31- """Mixin for testing when registrants get notified."""
32-
33- layer = DatabaseFunctionalLayer
34-
35- def setUp(self):
36- super(NotificationForRegistrantsMixin, self).setUp(
37- user='foo.bar@canonical.com')
38- self.pillar_owner = self.factory.makePerson(name="distro-owner")
39- self.bug_owner = self.factory.makePerson(name="bug-owner")
40- self.pillar = self.makePillar()
41- self.bug = self.factory.makeBug(
42- target=self.pillar, owner=self.bug_owner)
43-
44- def test_notification_does_not_use_malone(self):
45- self.pillar.official_malone = False
46- direct = self.bug.getDirectSubscribers()
47- indirect = self.bug.getIndirectSubscribers()
48- self.assertThat(direct, Not(Contains(self.pillar_owner)))
49- self.assertThat(indirect, Not(Contains(self.pillar_owner)))
50-
51- def test_status_change_does_not_use_malone(self):
52- # Status changes are sent to the direct and indirect subscribers.
53- self.pillar.official_malone = False
54- [bugtask] = self.bug.bugtasks
55- all_subscribers = set(
56- [person.name for person in chain(
57- self.bug.getDirectSubscribers(),
58- self.bug.getIndirectSubscribers())])
59- bugtask_before_modification = Snapshot(
60- bugtask, providing=providedBy(bugtask))
61- bugtask.transitionToStatus(
62- BugTaskStatus.INVALID, self.bug.owner)
63- notify(ObjectModifiedEvent(
64- bugtask, bugtask_before_modification, ['status'],
65- user=self.bug.owner))
66- latest_notification = BugNotification.selectFirst(orderBy='-id')
67- notified_people = set(
68- recipient.person.name
69- for recipient in latest_notification.recipients)
70- self.assertEqual(all_subscribers, notified_people)
71- self.assertThat(
72- all_subscribers, Not(Contains(self.pillar_owner.name)))
73-
74-
75-class TestNotificationsForRegistrantsForDistros(
76- NotificationForRegistrantsMixin, TestCaseWithFactory):
77- """Test when distribution registrants get notified."""
78-
79- def makePillar(self):
80- return self.factory.makeDistribution(owner=self.pillar_owner)
81-
82-
83-class TestNotificationsForRegistrantsForProducts(
84- NotificationForRegistrantsMixin, TestCaseWithFactory):
85- """Test when product registrants get notified."""
86-
87- def makePillar(self):
88- return self.factory.makeProduct(owner=self.pillar_owner)
89-
90-
91 class TestBug778847(TestCaseWithFactory):
92 """Regression tests for bug 778847."""
93