~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Curtis Hovey
  • Date: 2011-09-06 12:13:13 UTC
  • mfrom: (13883 devel)
  • mto: This revision was merged to the branch mainline in revision 13884.
  • Revision ID: curtis.hovey@canonical.com-20110906121313-2r9ep4ird8jw4nrl
Merged devel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2010 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
"""Tests for `StructuralSubscription`."""
5
5
 
6
6
__metaclass__ = type
7
7
 
8
 
from storm.expr import SQL
9
8
from storm.store import (
10
9
    EmptyResultSet,
11
10
    ResultSet,
15
14
from zope.security.interfaces import Unauthorized
16
15
 
17
16
from canonical.testing.layers import (
 
17
    DatabaseFunctionalLayer,
18
18
    LaunchpadFunctionalLayer,
19
 
    DatabaseFunctionalLayer,
20
19
    )
21
20
from lp.bugs.enum import BugNotificationLevel
22
21
from lp.bugs.interfaces.bugtask import (
24
23
    BugTaskStatus,
25
24
    )
26
25
from lp.bugs.mail.bugnotificationrecipients import BugNotificationRecipients
27
 
from lp.bugs.model.bugnotification import BugNotification
28
26
from lp.bugs.model.bugsubscriptionfilter import (
29
27
    BugSubscriptionFilter,
30
28
    BugSubscriptionFilterMute,
31
29
    MuteNotAllowed,
32
30
    )
33
31
from lp.bugs.model.structuralsubscription import (
34
 
    get_structural_subscriptions_for_bug,
35
32
    get_structural_subscribers,
36
33
    get_structural_subscription_targets,
 
34
    get_structural_subscriptions_for_bug,
37
35
    )
38
 
from lp.bugs.scripts.bugnotification import get_email_notifications
39
36
from lp.testing import (
40
37
    anonymous_logged_in,
41
38
    login_person,
527
524
            project=project, owner=project.owner)
528
525
        subscriber = self.factory.makePerson()
529
526
        with person_logged_in(subscriber):
530
 
            self_sub = project.addBugSubscription(subscriber, subscriber)
 
527
            project.addBugSubscription(subscriber, subscriber)
531
528
        # This is a sanity check.
532
529
        self.assertEqual(project, product.parent_subscription_target)
533
530
        bug = self.factory.makeBug(product=product)
536
533
            set([(bug.bugtasks[0], product), (bug.bugtasks[0], project)]),
537
534
            set(result))
538
535
 
 
536
 
539
537
class TestGetStructuralSubscriptionsForBug(TestCaseWithFactory):
540
538
 
541
539
    layer = DatabaseFunctionalLayer