def test_notifications(self): mail.outbox = [] wallpost = ShortReview() wallpost.user = self.user1 wallpost.review_text = "lorem ipsum @user,@b_as sid at ble" wallpost.status = Object.PUBLIC_STATUS wallpost.kind = ShortReview.WALLPOST wallpost.type = Object.TYPE_SHORT_REVIEW wallpost.save() self.assertEqual(len(mail.outbox), 2) self.assertTrue(wallpost.get_absolute_url() in mail.outbox[0].body) print mail.outbox[0].body mail.outbox = [] comment = ThreadedComment.objects.create_for_object( wallpost, user=self.user2, ip_address='127.0.0.1', comment="test comment @root", status=ThreadedComment.PUBLIC_STATUS, type=ThreadedComment.TYPE_COMMENT) self.assertEqual(len(mail.outbox), 1) self.assertTrue(comment.get_absolute_url() in mail.outbox[0].body) print mail.outbox[0].body mail.outbox = [] post = Post() post.title = "Lorem ipsum" post.permalink = "lorem-ipsum" post.lead = "lorem-ipsuam @root" post.body = "siala lala tralala @b_as" post.user = self.user1 post.status = Object.PUBLIC_STATUS post.type = Object.TYPE_POST post.save() self.assertEqual(len(mail.outbox), 2) self.assertTrue(post.get_absolute_url() in mail.outbox[0].body) print mail.outbox[0].body
def test_notifications( self ): mail.outbox = [] wallpost = ShortReview() wallpost.user = self.user1 wallpost.review_text = "lorem ipsum @user,@b_as sid at ble" wallpost.status = Object.PUBLIC_STATUS wallpost.kind = ShortReview.WALLPOST wallpost.type = Object.TYPE_SHORT_REVIEW wallpost.save() self.assertEqual( len( mail.outbox ), 2 ) self.assertTrue( wallpost.get_absolute_url() in mail.outbox[0].body ) print mail.outbox[0].body mail.outbox = [] comment = ThreadedComment.objects.create_for_object( wallpost, user=self.user2, ip_address='127.0.0.1',comment="test comment @root", status=ThreadedComment.PUBLIC_STATUS, type = ThreadedComment.TYPE_COMMENT ) self.assertEqual( len( mail.outbox ), 1 ) self.assertTrue( comment.get_absolute_url() in mail.outbox[0].body ) print mail.outbox[0].body mail.outbox = [] post = Post() post.title = "Lorem ipsum" post.permalink = "lorem-ipsum" post.lead = "lorem-ipsuam @root" post.body = "siala lala tralala @b_as" post.user = self.user1 post.status = Object.PUBLIC_STATUS post.type = Object.TYPE_POST post.save() self.assertEqual( len( mail.outbox ), 2 ) self.assertTrue( post.get_absolute_url() in mail.outbox[0].body ) print mail.outbox[0].body