~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

[bug=728370] [r=benji] adds all of the direct subscription actions
        for the unsubscribe in anger story.

Show diffs side-by-side

added added

removed removed

Lines of Context:
137
137
                    subscriber, subscriber, level=level)
138
138
            self.assertEqual(level, subscription.bug_notification_level)
139
139
 
 
140
    def test_resubscribe_with_level(self):
 
141
        # If you pass a new level to subscribe with an existing subscription,
 
142
        # the level is set on the existing subscription.
 
143
        bug = self.factory.makeBug()
 
144
        subscriber = self.factory.makePerson()
 
145
        levels = list(BugNotificationLevel.items)
 
146
        with person_logged_in(subscriber):
 
147
            subscription = bug.subscribe(
 
148
                subscriber, subscriber, level=levels[-1])
 
149
        for level in levels:
 
150
            with person_logged_in(subscriber):
 
151
                bug.subscribe(subscriber, subscriber, level=level)
 
152
            self.assertEqual(level, subscription.bug_notification_level)
 
153
 
140
154
    def test_get_direct_subscribers_with_level(self):
141
155
        # It's possible to pass a level parameter to
142
156
        # getDirectSubscribers() to filter the subscribers returned.