← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Gavin Panella has proposed merging lp:~allenap/launchpad/subscribe-to-tag-bug-151129-3 into lp:launchpad/devel with lp:~allenap/launchpad/subscribe-to-tag-bug-151129-2 as a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


Refactor tests to reduce work in setUp() for FilteredStructuralSubscriptionTestBase subclasses.
-- 
https://code.launchpad.net/~allenap/launchpad/subscribe-to-tag-bug-151129-3/+merge/41243
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/launchpad/subscribe-to-tag-bug-151129-3 into lp:launchpad/devel.
=== modified file 'lib/lp/registry/tests/test_structuralsubscriptiontarget.py'
--- lib/lp/registry/tests/test_structuralsubscriptiontarget.py	2010-11-18 22:13:07 +0000
+++ lib/lp/registry/tests/test_structuralsubscriptiontarget.py	2010-11-18 22:13:15 +0000
@@ -56,19 +56,16 @@
 from lp.testing.matchers import Provides
 
 
-class StructuralSubscriptionTestBase:
+class RestrictedStructuralSubscriptionTestBase:
+    """Tests suitable for a target that restricts structural subscriptions."""
 
     def setUp(self):
-        super(StructuralSubscriptionTestBase, self).setUp()
+        super(RestrictedStructuralSubscriptionTestBase, self).setUp()
         self.ordinary_subscriber = self.factory.makePerson()
         self.bug_supervisor_subscriber = self.factory.makePerson()
         self.team_owner = self.factory.makePerson()
         self.team = self.factory.makeTeam(owner=self.team_owner)
 
-
-class RestrictedStructuralSubscription(StructuralSubscriptionTestBase):
-    """Tests suitable for a target that restricts structural subscriptions."""
-
     def test_target_implements_structural_subscription_target(self):
         self.assertTrue(verifyObject(IStructuralSubscriptionTarget,
                                      self.target))
@@ -127,7 +124,8 @@
             self.ordinary_subscriber, self.ordinary_subscriber)
 
 
-class UnrestrictedStructuralSubscription(RestrictedStructuralSubscription):
+class UnrestrictedStructuralSubscriptionTestBase(
+    RestrictedStructuralSubscriptionTestBase):
     """
     Tests suitable for a target that does not restrict structural
     subscriptions.
@@ -174,7 +172,7 @@
             None)
 
 
-class FilteredStructuralSubscriptionTestBase(StructuralSubscriptionTestBase):
+class FilteredStructuralSubscriptionTestBase:
     """Tests for filtered structural subscriptions."""
 
     layer = LaunchpadFunctionalLayer
@@ -187,6 +185,7 @@
 
     def setUp(self):
         super(FilteredStructuralSubscriptionTestBase, self).setUp()
+        self.ordinary_subscriber = self.factory.makePerson()
         login_person(self.ordinary_subscriber)
         self.target = self.makeTarget()
         self.bugtask = self.makeBugTask()
@@ -442,7 +441,7 @@
 
 
 class TestStructuralSubscriptionForDistro(
-    RestrictedStructuralSubscription, TestCaseWithFactory):
+    RestrictedStructuralSubscriptionTestBase, TestCaseWithFactory):
 
     layer = LaunchpadFunctionalLayer
 
@@ -513,7 +512,7 @@
 
 
 class TestStructuralSubscriptionForProduct(
-    UnrestrictedStructuralSubscription, TestCaseWithFactory):
+    UnrestrictedStructuralSubscriptionTestBase, TestCaseWithFactory):
 
     layer = LaunchpadFunctionalLayer
 
@@ -530,7 +529,7 @@
 
 
 class TestStructuralSubscriptionForDistroSourcePackage(
-    UnrestrictedStructuralSubscription, TestCaseWithFactory):
+    UnrestrictedStructuralSubscriptionTestBase, TestCaseWithFactory):
 
     layer = LaunchpadFunctionalLayer
 
@@ -548,7 +547,7 @@
 
 
 class TestStructuralSubscriptionForMilestone(
-    UnrestrictedStructuralSubscription, TestCaseWithFactory):
+    UnrestrictedStructuralSubscriptionTestBase, TestCaseWithFactory):
 
     layer = LaunchpadFunctionalLayer
 
@@ -569,7 +568,7 @@
 
 
 class TestStructuralSubscriptionForDistroSeries(
-    UnrestrictedStructuralSubscription, TestCaseWithFactory):
+    UnrestrictedStructuralSubscriptionTestBase, TestCaseWithFactory):
 
     layer = LaunchpadFunctionalLayer
 
@@ -587,7 +586,7 @@
 
 
 class TestStructuralSubscriptionForProjectGroup(
-    UnrestrictedStructuralSubscription, TestCaseWithFactory):
+    UnrestrictedStructuralSubscriptionTestBase, TestCaseWithFactory):
 
     layer = LaunchpadFunctionalLayer
 
@@ -609,7 +608,7 @@
 
 
 class TestStructuralSubscriptionForProductSeries(
-    UnrestrictedStructuralSubscription, TestCaseWithFactory):
+    UnrestrictedStructuralSubscriptionTestBase, TestCaseWithFactory):
 
     layer = LaunchpadFunctionalLayer