249
249
subscriber not in duplicate_subscribers,
250
250
"Subscriber should not be in duplicate_subscribers.")
252
def test_subscribers_from_dupes_includes_structural_subscribers(self):
253
# getSubscribersFromDuplicates() also returns subscribers
254
# from structural subscriptions.
255
product = self.factory.makeProduct()
256
bug = self.factory.makeBug()
257
duplicate_bug = self.factory.makeBug(product=product)
258
with person_logged_in(duplicate_bug.owner):
259
duplicate_bug.markAsDuplicate(bug)
260
# We unsubscribe the owner of the duplicate to avoid muddling
261
# the results retuned by getSubscribersFromDuplicates()
262
duplicate_bug.unsubscribe(
263
duplicate_bug.owner, duplicate_bug.owner)
265
subscriber = self.factory.makePerson()
266
with person_logged_in(subscriber):
267
product.addSubscription(subscriber, subscriber)
271
bug.getSubscribersFromDuplicates())
252
273
def test_getSubscriptionInfo(self):
253
274
# getSubscriptionInfo() returns a BugSubscriptionInfo object.
254
275
bug = self.factory.makeBug()
261
282
with person_logged_in(bug.owner):
262
283
info = bug.getSubscriptionInfo(BugNotificationLevel.METADATA)
263
284
self.assertEqual(BugNotificationLevel.METADATA, info.level)
286
def test_personIsAlsoNotifiedSubscriber_direct_subscriber(self):
287
# personIsAlsoNotifiedSubscriber() returns false for
288
# direct subscribers.
289
product = self.factory.makeProduct()
290
bug = self.factory.makeBug()
292
subscriber = self.factory.makePerson()
293
with person_logged_in(subscriber):
294
bug.subscribe(subscriber, subscriber)
297
bug.personIsAlsoNotifiedSubscriber(subscriber))
299
def test_personIsAlsoNotifiedSubscriber_direct_subscriber_team(self):
300
# personIsAlsoNotifiedSubscriber() returns true for
301
# direct subscribers even if a team they are a member of
302
# is the direct subscriber to the bug.
303
product = self.factory.makeProduct()
304
bug = self.factory.makeBug()
306
person = self.factory.makePerson()
307
subscriber = self.factory.makeTeam(members=[person])
309
with person_logged_in(subscriber.teamowner):
310
bug.subscribe(subscriber, subscriber.teamowner)
313
bug.personIsAlsoNotifiedSubscriber(person))
315
def test_personIsAlsoNotifiedSubscriber_duplicate_subscriber(self):
316
# personIsAlsoNotifiedSubscriber() returns false for
317
# duplicate subscribers.
318
product = self.factory.makeProduct()
319
bug = self.factory.makeBug()
320
duplicate_bug = self.factory.makeBug(product=product)
321
with person_logged_in(duplicate_bug.owner):
322
duplicate_bug.markAsDuplicate(bug)
323
# We unsubscribe the owner of the duplicate to avoid muddling
324
# the results retuned by getSubscribersFromDuplicates()
325
duplicate_bug.unsubscribe(
326
duplicate_bug.owner, duplicate_bug.owner)
328
subscriber = self.factory.makePerson()
329
with person_logged_in(subscriber):
330
duplicate_bug.subscribe(subscriber, subscriber)
333
bug.personIsAlsoNotifiedSubscriber(subscriber))
335
def test_personIsAlsoNotifiedSubscriber_duplicate_subscriber_team(self):
336
# personIsAlsoNotifiedSubscriber() returns true for
337
# duplicate subscribers even if a team they are a member of
338
# is the direct subscriber to the duplicate bug.
339
product = self.factory.makeProduct()
340
bug = self.factory.makeBug()
341
duplicate_bug = self.factory.makeBug(product=product)
342
with person_logged_in(duplicate_bug.owner):
343
duplicate_bug.markAsDuplicate(bug)
344
# We unsubscribe the owner of the duplicate to avoid muddling
345
# the results retuned by getSubscribersFromDuplicates()
346
duplicate_bug.unsubscribe(
347
duplicate_bug.owner, duplicate_bug.owner)
349
person = self.factory.makePerson()
350
subscriber = self.factory.makeTeam(members=[person])
352
with person_logged_in(subscriber.teamowner):
353
duplicate_bug.subscribe(subscriber, subscriber.teamowner)
356
bug.personIsAlsoNotifiedSubscriber(person))