~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/model/tests/test_bugsubscriptioninfo.py

  • Committer: Julian Edwards
  • Date: 2011-06-06 11:49:08 UTC
  • mfrom: (7675.1045.467 db-devel)
  • mto: This revision was merged to the branch mainline in revision 13205.
  • Revision ID: julian.edwards@canonical.com-20110606114908-30jm0009t79ewsad
merge db-devel, there are some test failures as a result

Show diffs side-by-side

added added

removed removed

Lines of Context:
237
237
        self.assertEqual(set(), found_subscriptions)
238
238
 
239
239
    def test_structural(self):
240
 
        # The set of structural subscribers.
 
240
        # The set of structural subscriptions.
241
241
        subscribers = (
242
242
            self.factory.makePerson(),
243
243
            self.factory.makePerson())
251
251
        self.assertEqual(set(subscribers), found_subscriptions.subscribers)
252
252
        self.assertEqual(subscribers, found_subscriptions.subscribers.sorted)
253
253
 
 
254
    def test_structural_subscriptions_from_duplicates(self):
 
255
        # The set of structural subscriptions from duplicates.
 
256
        subscribers = (self.factory.makePerson(), self.factory.makePerson())
 
257
        # Note that this duplicate_bug will have a different target than the
 
258
        # main bug's.
 
259
        duplicate_bug = self.factory.makeBug()
 
260
        with person_logged_in(duplicate_bug.owner):
 
261
            duplicate_bug.markAsDuplicate(self.bug)
 
262
        target = duplicate_bug.default_bugtask.target
 
263
        subscriptions = []
 
264
        for subscriber in subscribers:
 
265
            with person_logged_in(subscriber):
 
266
                subscriptions.append(target.addBugSubscription(
 
267
                    subscriber, subscriber))
 
268
        found_subscriptions = (
 
269
            self.getInfo().structural_subscriptions_from_duplicates)
 
270
        self.assertEqual(set(subscriptions), found_subscriptions)
 
271
        self.assertEqual(set(subscribers), found_subscriptions.subscribers)
 
272
        # There's no particular order of our subscriptions, so sorted does
 
273
        # not compare.
 
274
        # self.assertEqual(subscriptions, found_subscriptions.sorted)
 
275
        # self.assertEqual(subscribers, found_subscriptions.subscribers.sorted)
 
276
 
254
277
    def test_all_assignees(self):
255
278
        # The set of bugtask assignees for bugtasks that have been assigned.
256
279
        found_assignees = self.getInfo().all_assignees