~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/answers/tests/test_question_notifications.py

  • Committer: Curtis Hovey
  • Date: 2011-04-29 15:29:04 UTC
  • mto: This revision was merged to the branch mainline in revision 12976.
  • Revision ID: curtis.hovey@canonical.com-20110429152904-4b2wteyzlg33x8kn
Added recipient_set to QuestionModifiedDefaultNotification.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
        self.notification = TestQuestionModifiedNotification(
68
68
            StubQuestion(), FakeEvent())
69
69
 
 
70
    def test_recipient_set(self):
 
71
        self.assertEqual(
 
72
            QuestionRecipientSet.SUBSCRIBER,
 
73
            self.notification.recipient_set)
 
74
 
70
75
    def test_buildBody_with_separator(self):
71
76
        # A body with a separator is preserved.
72
77
        formatted_body = self.notification.buildBody(
106
111
class QuestionAddedNotificationTestCase(TestCase):
107
112
    """Test cases for mail notifications about created questions."""
108
113
 
 
114
    def setUp(self):
 
115
        """Create a notification with a fake question."""
 
116
        self.question = StubQuestion()
 
117
        self.event = FakeEvent()
 
118
        self.notification = TestQuestionAddedNotification(
 
119
            self.question, self.event)
 
120
 
109
121
    def test_recipient_set(self):
110
 
        question = StubQuestion()
111
 
        notification = TestQuestionAddedNotification(question, FakeEvent())
112
122
        self.assertEqual(
113
123
            QuestionRecipientSet.ASKER_SUBSCRIBER,
114
 
            notification.recipient_set)
 
124
            self.notification.recipient_set)
115
125
 
116
126
    def test_user_is_question_owner(self):
117
127
        """The notification user is always the question owner."""
118
 
        question = StubQuestion()
119
 
        event = FakeEvent()
120
 
        notification = TestQuestionAddedNotification(question, event)
121
 
        self.assertEqual(question.owner, notification.user)
122
 
        self.assertNotEqual(event.user, notification.user)
 
128
        self.assertEqual(self.question.owner, self.notification.user)
 
129
        self.assertNotEqual(self.event.user, self.notification.user)