Merge lp:~allenap/launchpad/subscribe-to-tag-bug-151129-3 into lp:launchpad

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: no longer in the source branch.
Merged at revision: 11972
Proposed branch: lp:~allenap/launchpad/subscribe-to-tag-bug-151129-3
Merge into: lp:launchpad
Prerequisite: lp:~allenap/launchpad/subscribe-to-tag-bug-151129-2
Diff against target: 115 lines (+14/-15)
1 file modified
lib/lp/registry/tests/test_structuralsubscriptiontarget.py (+14/-15)
To merge this branch: bzr merge lp:~allenap/launchpad/subscribe-to-tag-bug-151129-3
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code Approve
Review via email: mp+41243@code.launchpad.net

Commit message

[r=bac][ui=none] [r=henninge,adeuring,jcsackett,bac][ui=none][bug=151129] Change the approach to finding structural subscriptions matching a bugtask.

Description of the change

Refactor tests to reduce work in setUp() for FilteredStructuralSubscriptionTestBase subclasses.

To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) wrote :

Very straightforward branch. Thanks.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/tests/test_structuralsubscriptiontarget.py'
2--- lib/lp/registry/tests/test_structuralsubscriptiontarget.py 2010-11-24 09:47:02 +0000
3+++ lib/lp/registry/tests/test_structuralsubscriptiontarget.py 2010-11-24 09:47:04 +0000
4@@ -56,19 +56,16 @@
5 from lp.testing.matchers import Provides
6
7
8-class StructuralSubscriptionTestBase:
9+class RestrictedStructuralSubscriptionTestBase:
10+ """Tests suitable for a target that restricts structural subscriptions."""
11
12 def setUp(self):
13- super(StructuralSubscriptionTestBase, self).setUp()
14+ super(RestrictedStructuralSubscriptionTestBase, self).setUp()
15 self.ordinary_subscriber = self.factory.makePerson()
16 self.bug_supervisor_subscriber = self.factory.makePerson()
17 self.team_owner = self.factory.makePerson()
18 self.team = self.factory.makeTeam(owner=self.team_owner)
19
20-
21-class RestrictedStructuralSubscription(StructuralSubscriptionTestBase):
22- """Tests suitable for a target that restricts structural subscriptions."""
23-
24 def test_target_implements_structural_subscription_target(self):
25 self.assertTrue(verifyObject(IStructuralSubscriptionTarget,
26 self.target))
27@@ -127,7 +124,8 @@
28 self.ordinary_subscriber, self.ordinary_subscriber)
29
30
31-class UnrestrictedStructuralSubscription(RestrictedStructuralSubscription):
32+class UnrestrictedStructuralSubscriptionTestBase(
33+ RestrictedStructuralSubscriptionTestBase):
34 """
35 Tests suitable for a target that does not restrict structural
36 subscriptions.
37@@ -174,7 +172,7 @@
38 None)
39
40
41-class FilteredStructuralSubscriptionTestBase(StructuralSubscriptionTestBase):
42+class FilteredStructuralSubscriptionTestBase:
43 """Tests for filtered structural subscriptions."""
44
45 layer = LaunchpadFunctionalLayer
46@@ -187,6 +185,7 @@
47
48 def setUp(self):
49 super(FilteredStructuralSubscriptionTestBase, self).setUp()
50+ self.ordinary_subscriber = self.factory.makePerson()
51 login_person(self.ordinary_subscriber)
52 self.target = self.makeTarget()
53 self.bugtask = self.makeBugTask()
54@@ -442,7 +441,7 @@
55
56
57 class TestStructuralSubscriptionForDistro(
58- RestrictedStructuralSubscription, TestCaseWithFactory):
59+ RestrictedStructuralSubscriptionTestBase, TestCaseWithFactory):
60
61 layer = LaunchpadFunctionalLayer
62
63@@ -513,7 +512,7 @@
64
65
66 class TestStructuralSubscriptionForProduct(
67- UnrestrictedStructuralSubscription, TestCaseWithFactory):
68+ UnrestrictedStructuralSubscriptionTestBase, TestCaseWithFactory):
69
70 layer = LaunchpadFunctionalLayer
71
72@@ -530,7 +529,7 @@
73
74
75 class TestStructuralSubscriptionForDistroSourcePackage(
76- UnrestrictedStructuralSubscription, TestCaseWithFactory):
77+ UnrestrictedStructuralSubscriptionTestBase, TestCaseWithFactory):
78
79 layer = LaunchpadFunctionalLayer
80
81@@ -548,7 +547,7 @@
82
83
84 class TestStructuralSubscriptionForMilestone(
85- UnrestrictedStructuralSubscription, TestCaseWithFactory):
86+ UnrestrictedStructuralSubscriptionTestBase, TestCaseWithFactory):
87
88 layer = LaunchpadFunctionalLayer
89
90@@ -569,7 +568,7 @@
91
92
93 class TestStructuralSubscriptionForDistroSeries(
94- UnrestrictedStructuralSubscription, TestCaseWithFactory):
95+ UnrestrictedStructuralSubscriptionTestBase, TestCaseWithFactory):
96
97 layer = LaunchpadFunctionalLayer
98
99@@ -587,7 +586,7 @@
100
101
102 class TestStructuralSubscriptionForProjectGroup(
103- UnrestrictedStructuralSubscription, TestCaseWithFactory):
104+ UnrestrictedStructuralSubscriptionTestBase, TestCaseWithFactory):
105
106 layer = LaunchpadFunctionalLayer
107
108@@ -609,7 +608,7 @@
109
110
111 class TestStructuralSubscriptionForProductSeries(
112- UnrestrictedStructuralSubscription, TestCaseWithFactory):
113+ UnrestrictedStructuralSubscriptionTestBase, TestCaseWithFactory):
114
115 layer = LaunchpadFunctionalLayer
116