def test_upvote_answer_notification(self): Profile.objects.get(user=self.other_user).notify_upvoted_answer( self.answer) notification = Notification.objects.get(answer=self.answer) test_string = Notification._UPVOTED_ANSWER_TEMPLATE.format( self.other_user.username, self.other_user.profile.get_screen_name(), self.answer.pk, Notification.get_summary(notification, self.answer.description)) assert isinstance(notification, Notification) assert str(notification) == test_string
def test_upvote_question_notification(self): Profile.objects.get(user=self.other_user).notify_upvoted_question( self.question) notification = Notification.objects.get(question=self.question) test_string = Notification._UPVOTED_QUESTION_TEMPLATE.format( self.other_user.username, self.other_user.profile.get_screen_name(), self.question.pk, Notification.get_summary(notification, self.question.title)) assert isinstance(notification, Notification) assert str(notification) == test_string