~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/model/tests/test_bugsubscriptioninfo.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:
211
211
        self.assertEqual(set(), found_subscriptions)
212
212
 
213
213
    def test_structural(self):
214
 
        # The set of structural subscribers.
 
214
        # The set of structural subscriptions.
215
215
        subscribers = (
216
216
            self.factory.makePerson(),
217
217
            self.factory.makePerson())
225
225
        self.assertEqual(set(subscribers), found_subscriptions.subscribers)
226
226
        self.assertEqual(subscribers, found_subscriptions.subscribers.sorted)
227
227
 
 
228
    def test_structural_subscriptions_from_duplicates(self):
 
229
        # The set of structural subscriptions from duplicates.
 
230
        subscribers = (self.factory.makePerson(), self.factory.makePerson())
 
231
        # Note that this duplicate_bug will have a different target than the
 
232
        # main bug's.
 
233
        duplicate_bug = self.factory.makeBug()
 
234
        with person_logged_in(duplicate_bug.owner):
 
235
            duplicate_bug.markAsDuplicate(self.bug)
 
236
        target = duplicate_bug.default_bugtask.target
 
237
        subscriptions = []
 
238
        for subscriber in subscribers:
 
239
            with person_logged_in(subscriber):
 
240
                subscriptions.append(target.addBugSubscription(
 
241
                    subscriber, subscriber))
 
242
        found_subscriptions = (
 
243
            self.getInfo().structural_subscriptions_from_duplicates)
 
244
        self.assertEqual(set(subscriptions), found_subscriptions)
 
245
        self.assertEqual(set(subscribers), found_subscriptions.subscribers)
 
246
        # There's no particular order of our subscriptions, so sorted does
 
247
        # not compare.
 
248
        # self.assertEqual(subscriptions, found_subscriptions.sorted)
 
249
        # self.assertEqual(subscribers, found_subscriptions.subscribers.sorted)
 
250
 
228
251
    def test_all_assignees(self):
229
252
        # The set of bugtask assignees for bugtasks that have been assigned.
230
253
        found_assignees = self.getInfo().all_assignees