~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/tests/test_bugsubscription.py

[r=gmb][bug=772609] The mute link will now appear for members of
        teams that are structurally subscribed to a bug or its duplicates

Show diffs side-by-side

added added

removed removed

Lines of Context:
146
146
                self.bug.id, team_2.name, self.subscriber)
147
147
        self.assertThat(
148
148
            collector, HasQueryCount(LessThan(25)))
 
149
 
 
150
 
 
151
class TestBugSubscriptionMethods(TestCaseWithFactory):
 
152
    """A TestCase for the subscription-related methods of `Bug`."""
 
153
 
 
154
    layer = DatabaseFunctionalLayer
 
155
 
 
156
    def test_getSubscribersFromDuplicates_returns_empty_when_private(self):
 
157
        # If a private bug has duplicates its
 
158
        # getSubscribersFromDuplicates() method should return an empty
 
159
        # set.
 
160
        # This is a regression test for bug 780248.
 
161
        bug = self.factory.makeBug()
 
162
        duplicate = self.factory.makeBug()
 
163
        team = self.factory.makeTeam()
 
164
        with person_logged_in(team.teamowner):
 
165
            duplicate.default_bugtask.product.addSubscription(
 
166
                team, team.teamowner)
 
167
        with person_logged_in(bug.owner):
 
168
            bug.setPrivate(True, bug.owner)
 
169
            duplicate.markAsDuplicate(bug)
 
170
            duplicate_subscribers = bug.getSubscribersFromDuplicates()
 
171
            self.assertEqual(0, len(duplicate_subscribers))