67
67
self.notification = TestQuestionModifiedNotification(
68
68
StubQuestion(), FakeEvent())
70
def test_recipient_set(self):
72
QuestionRecipientSet.SUBSCRIBER,
73
self.notification.recipient_set)
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."""
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)
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)
116
126
def test_user_is_question_owner(self):
117
127
"""The notification user is always the question owner."""
118
question = StubQuestion()
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)