示例#1
0
    def test_updating_shortreview_activity(self):
        """
           Test updating shortreview activity
        """

        self.initialize()

        # set up Shortreview
        obj = Object.objects.get(id=self.film.id)
        shortreview = ShortReview()
        shortreview.user = self.u1
        shortreview.review_text = "sialala bumcyk cyk"
        shortreview.status = Object.PUBLIC_STATUS
        shortreview.type = Object.TYPE_SHORT_REVIEW
        shortreview.object = obj
        shortreview.kind = ShortReview.REVIEW
        shortreview.save()

        shortreview = ShortReview.objects.get(id=shortreview.id)
        shortreview.review_text = "Lorem ipsum"
        shortreview.status = Object.DELETED_STATUS
        shortreview.save()

        activity = UserActivity.objects.get(short_review=shortreview)
        
        # testing if activity was updated properly
        self.failUnlessEqual(activity.title, shortreview.get_title())
        self.failUnlessEqual(activity.content, "Lorem ipsum")
        self.failUnlessEqual(activity.permalink, shortreview.get_absolute_url())
        self.failUnlessEqual(activity.status, UserActivity.DELETED_STATUS)
        self.failUnlessEqual(activity.activity_type, UserActivity.TYPE_SHORT_REVIEW)
        self.failUnlessEqual(activity.username, self.u1.username)
        self.failUnlessEqual(activity.film_title, self.film.title)
        self.failUnlessEqual(activity.film_permalink, self.film.permalink)
示例#2
0
    def test_saving_double_shortreviews(self):
        """
           Test saving two shortreviews about the same movie by the same user
        """

        self.initialize()

        # set up Shortreviews
        obj = Object.objects.get(id=self.film.id)
        shortreview1 = ShortReview()
        shortreview1.user = self.u1
        shortreview1.review_text = "sialala bumcyk cyk"
        shortreview1.status = Object.PUBLIC_STATUS
        shortreview1.type = Object.TYPE_SHORT_REVIEW
        shortreview1.kind = ShortReview.REVIEW
        shortreview1.object = obj
        shortreview1.rating = self.rating
        shortreview1.save()

        obj = Object.objects.get(id=self.film.id)
        shortreview2 = ShortReview()
        shortreview2.user = self.u1
        shortreview2.review_text = "Lorem ipsum lorem ipsum"
        shortreview2.status = Object.PUBLIC_STATUS
        shortreview2.type = Object.TYPE_SHORT_REVIEW
        shortreview2.kind = ShortReview.REVIEW
        shortreview2.object = obj
        shortreview2.rating = self.rating
        shortreview2.save()


        # testing if shortreview was saved
        sr = ShortReview.objects.filter(object=obj).order_by("created_at")

        self.failUnlessEqual(sr[0].user, shortreview1.user)
        self.failUnlessEqual(sr[0].review_text, "sialala bumcyk cyk")
        self.failUnlessEqual(sr[0].status, Object.PUBLIC_STATUS)
        self.failUnlessEqual(sr[0].type, Object.TYPE_SHORT_REVIEW)
        self.failUnlessEqual(sr[0].kind, ShortReview.REVIEW)
        self.failUnlessEqual(sr[0].rating.rating, 8)
        self.failUnlessEqual(sr[0].object, obj)

        self.failUnlessEqual(sr[1].user, shortreview1.user)
        self.failUnlessEqual(sr[1].review_text, "Lorem ipsum lorem ipsum")
        self.failUnlessEqual(sr[1].status, Object.PUBLIC_STATUS)
        self.failUnlessEqual(sr[1].type, Object.TYPE_SHORT_REVIEW)
        self.failUnlessEqual(sr[1].kind, ShortReview.REVIEW)
        self.failUnlessEqual(sr[1].rating.rating, 8)
        self.failUnlessEqual(sr[1].object, obj)
示例#3
0
    def test_saving_double_shortreviews(self):
        """
           Test saving two shortreviews about the same movie by the same user
        """

        self.initialize()

        # set up Shortreviews
        obj = Object.objects.get(id=self.film.id)
        shortreview1 = ShortReview()
        shortreview1.user = self.u1
        shortreview1.review_text = "sialala bumcyk cyk"
        shortreview1.status = Object.PUBLIC_STATUS
        shortreview1.type = Object.TYPE_SHORT_REVIEW
        shortreview1.kind = ShortReview.REVIEW
        shortreview1.object = obj
        shortreview1.rating = self.rating
        shortreview1.save()

        obj = Object.objects.get(id=self.film.id)
        shortreview2 = ShortReview()
        shortreview2.user = self.u1
        shortreview2.review_text = "Lorem ipsum lorem ipsum"
        shortreview2.status = Object.PUBLIC_STATUS
        shortreview2.type = Object.TYPE_SHORT_REVIEW
        shortreview2.kind = ShortReview.REVIEW
        shortreview2.object = obj
        shortreview2.rating = self.rating
        shortreview2.save()


        # testing if shortreview was saved
        sr = ShortReview.objects.filter(object=obj).order_by("created_at")

        self.failUnlessEqual(sr[0].user, shortreview1.user)
        self.failUnlessEqual(sr[0].review_text, "sialala bumcyk cyk")
        self.failUnlessEqual(sr[0].status, Object.PUBLIC_STATUS)
        self.failUnlessEqual(sr[0].type, Object.TYPE_SHORT_REVIEW)
        self.failUnlessEqual(sr[0].kind, ShortReview.REVIEW)
        self.failUnlessEqual(sr[0].rating.rating, 8)
        self.failUnlessEqual(sr[0].object, obj)

        self.failUnlessEqual(sr[1].user, shortreview1.user)
        self.failUnlessEqual(sr[1].review_text, "Lorem ipsum lorem ipsum")
        self.failUnlessEqual(sr[1].status, Object.PUBLIC_STATUS)
        self.failUnlessEqual(sr[1].type, Object.TYPE_SHORT_REVIEW)
        self.failUnlessEqual(sr[1].kind, ShortReview.REVIEW)
        self.failUnlessEqual(sr[1].rating.rating, 8)
        self.failUnlessEqual(sr[1].object, obj)
示例#4
0
    def test_saving_single_shortreview(self):
        """
           Test saving single shortreview
        """

        self.initialize()

        # set up Shortreview
        obj = Object.objects.get(id=self.film.id)
        shortreview = ShortReview()
        shortreview.user = self.u1
        shortreview.review_text = "sialala bumcyk cyk"
        shortreview.status = Object.PUBLIC_STATUS
        shortreview.type = Object.TYPE_SHORT_REVIEW
        shortreview.kind = ShortReview.REVIEW
        shortreview.object = obj
        shortreview.rating = self.rating
        shortreview.save()

        # testing if shortreview was saved
        sr = ShortReview.objects.get(object=obj)
        
        self.failUnlessEqual(sr.user, shortreview.user)
        self.failUnlessEqual(sr.review_text, "sialala bumcyk cyk")
        self.failUnlessEqual(sr.status, Object.PUBLIC_STATUS)
        self.failUnlessEqual(sr.type, Object.TYPE_SHORT_REVIEW)
        self.failUnlessEqual(sr.kind, ShortReview.REVIEW)
        self.failUnlessEqual(sr.rating.rating, 8)
        self.failUnlessEqual(sr.object, obj)
示例#5
0
    def test_delete_single_shortreview(self):
        """
            Test deleting single shortreview
        """

        self.initialize()

        # set up Shortreview
        obj = Object.objects.get(id=self.film.id)
        shortreview = ShortReview()
        shortreview.user = self.u1
        shortreview.review_text = "sialala bumcyk cyk"
        shortreview.status = Object.PUBLIC_STATUS
        shortreview.type = Object.TYPE_SHORT_REVIEW
        shortreview.kind = ShortReview.REVIEW
        shortreview.object = obj
        shortreview.save()

        # there should be one short review
        self.failUnlessEqual(ShortReview.objects.all().count(), 1)

        sr = ShortReview.objects.get(object=obj)

        # deleting shortreview
        sr.delete()

        # there should be zero short reviews
        self.failUnlessEqual(ShortReview.objects.all().count(), 0)
示例#6
0
    def test_delete_single_shortreview(self):
        """
            Test deleting single shortreview
        """

        self.initialize()

        # set up Shortreview
        obj = Object.objects.get(id=self.film.id)
        shortreview = ShortReview()
        shortreview.user = self.u1
        shortreview.review_text = "sialala bumcyk cyk"
        shortreview.status = Object.PUBLIC_STATUS
        shortreview.type = Object.TYPE_SHORT_REVIEW
        shortreview.kind = ShortReview.REVIEW
        shortreview.object = obj
        shortreview.save()

        # there should be one short review
        self.failUnlessEqual(ShortReview.objects.all().count(), 1)

        sr = ShortReview.objects.get(object=obj)

        # deleting shortreview
        sr.delete()

        # there should be zero short reviews
        self.failUnlessEqual(ShortReview.objects.all().count(), 0)
示例#7
0
    def test_saving_single_shortreview(self):
        """
           Test saving single shortreview
        """

        self.initialize()

        # set up Shortreview
        obj = Object.objects.get(id=self.film.id)
        shortreview = ShortReview()
        shortreview.user = self.u1
        shortreview.review_text = "sialala bumcyk cyk"
        shortreview.status = Object.PUBLIC_STATUS
        shortreview.type = Object.TYPE_SHORT_REVIEW
        shortreview.kind = ShortReview.REVIEW
        shortreview.object = obj
        shortreview.rating = self.rating
        shortreview.save()

        # testing if shortreview was saved
        sr = ShortReview.objects.get(object=obj)
        
        self.failUnlessEqual(sr.user, shortreview.user)
        self.failUnlessEqual(sr.review_text, "sialala bumcyk cyk")
        self.failUnlessEqual(sr.status, Object.PUBLIC_STATUS)
        self.failUnlessEqual(sr.type, Object.TYPE_SHORT_REVIEW)
        self.failUnlessEqual(sr.kind, ShortReview.REVIEW)
        self.failUnlessEqual(sr.rating.rating, 8)
        self.failUnlessEqual(sr.object, obj)
示例#8
0
    def test_edit_single_shortreview(self):
        """
            Test editing single shortreview
        """

        self.initialize()

        # set up Shortreview
        obj = Object.objects.get(id=self.film.id)
        shortreview = ShortReview()
        shortreview.user = self.u1
        shortreview.review_text = "sialala bumcyk cyk"
        shortreview.status = Object.PUBLIC_STATUS
        shortreview.type = Object.TYPE_SHORT_REVIEW
        shortreview.kind = ShortReview.REVIEW
        shortreview.object = obj
        shortreview.save()
        shortreview.rating.rating = 10
        shortreview.rating.save()

        # testing if shortreview was saved
        sr = ShortReview.objects.get(object=obj)

        self.failUnlessEqual(sr.review_text, "sialala bumcyk cyk")

        sr.review_text = "Lorem ipsum"
        sr.save()

        # testing if short review was edited successfully
        sr = ShortReview.objects.get(object=obj)
        self.failUnlessEqual(sr.review_text, "Lorem ipsum")
        self.failUnlessEqual(sr.rating.rating, 10)
示例#9
0
    def test_saving_shortreview_activity(self):
        """
           Test saving shortreview activity     
        """

        self.initialize()

        # set up Shortreview
        obj = Object.objects.get(id=self.film.id)
        shortreview = ShortReview()
        shortreview.user = self.u1
        shortreview.review_text = "sialala bumcyk cyk"
        shortreview.status = Object.PUBLIC_STATUS
        shortreview.type = Object.TYPE_SHORT_REVIEW
        shortreview.object = obj
        shortreview.kind = ShortReview.REVIEW
        shortreview.save()

        activity = UserActivity.objects.get(short_review=shortreview)

        # testing if activity was saved properly
        self.failUnlessEqual(activity.title, shortreview.get_title())
        self.failUnlessEqual(activity.content, shortreview.review_text)
        self.failUnlessEqual(activity.permalink,
                             shortreview.get_absolute_url())
        self.failUnlessEqual(activity.status, shortreview.status)
        self.failUnlessEqual(activity.activity_type,
                             UserActivity.TYPE_SHORT_REVIEW)
        self.failUnlessEqual(activity.username, self.u1.username)
        self.failUnlessEqual(activity.film_title, self.film.title)
        self.failUnlessEqual(activity.film_permalink, self.film.permalink)
示例#10
0
    def test_edit_single_shortreview(self):
        """
            Test editing single shortreview
        """

        self.initialize()

        # set up Shortreview
        obj = Object.objects.get(id=self.film.id)
        shortreview = ShortReview()
        shortreview.user = self.u1
        shortreview.review_text = "sialala bumcyk cyk"
        shortreview.status = Object.PUBLIC_STATUS
        shortreview.type = Object.TYPE_SHORT_REVIEW
        shortreview.kind = ShortReview.REVIEW
        shortreview.object = obj
        shortreview.save()
        shortreview.rating.rating = 10
        shortreview.rating.save()

        # testing if shortreview was saved
        sr = ShortReview.objects.get(object=obj)

        self.failUnlessEqual(sr.review_text, "sialala bumcyk cyk")

        sr.review_text = "Lorem ipsum"
        sr.save()

        # testing if short review was edited successfully
        sr = ShortReview.objects.get(object=obj)
        self.failUnlessEqual(sr.review_text, "Lorem ipsum")
        self.failUnlessEqual(sr.rating.rating, 10)
示例#11
0
    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
示例#12
0
    def test_show_wall_post_ok(self):
        """
            Test show_wall_post - article exist!
        """
        shortreview = ShortReview()
        shortreview.user = self.u1
        shortreview.review_text = "sialala bumcyk cyk"
        shortreview.status = ShortReview.PUBLIC_STATUS
        shortreview.type = ShortReview.TYPE_SHORT_REVIEW
        shortreview.kind = ShortReview.REVIEW
        shortreview.save()

        response = self.client.get(shortreview.get_absolute_url())

        self.failUnlessEqual(response.status_code, 200)
        self.assertEqual(response.context["activity"].content, "sialala bumcyk cyk")
示例#13
0
    def test_show_wall_post_ok(self):
        """
            Test show_wall_post - article exist!
        """
        shortreview = ShortReview()
        shortreview.user = self.u1
        shortreview.review_text = "sialala bumcyk cyk"
        shortreview.status = ShortReview.PUBLIC_STATUS
        shortreview.type = ShortReview.TYPE_SHORT_REVIEW
        shortreview.kind = ShortReview.REVIEW
        shortreview.save()

        response = self.client.get(shortreview.get_absolute_url())

        self.failUnlessEqual(response.status_code, 200)
        self.assertEqual(response.context['activity'].content,
                         "sialala bumcyk cyk")
示例#14
0
    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
示例#15
0
    def test_saving_wall_post(self):
        """
            Test saving wall post
        """

        self.initialize()

        wallpost = ShortReview()
        wallpost.user = self.u1
        wallpost.review_text = "sialala bumcyk cyk"
        wallpost.status = Object.PUBLIC_STATUS
        wallpost.kind = ShortReview.WALLPOST
        wallpost.type = Object.TYPE_SHORT_REVIEW
        wallpost.save()

        permalink = 'http://%s.%s/%s/%s/' % (self.u1.username, settings.DOMAIN, urls['WALL'], wallpost.id)
        wp = ShortReview.objects.all()[0]

        self.failUnlessEqual(wp.get_absolute_url(), permalink)
        self.failUnlessEqual(wp.user, wallpost.user)
        self.failUnlessEqual(wp.review_text, "sialala bumcyk cyk")
        self.failUnlessEqual(wp.status, Object.PUBLIC_STATUS)
        self.failUnlessEqual(wp.type, Object.TYPE_SHORT_REVIEW)
示例#16
0
    def test_saving_wall_post(self):
        """
            Test saving wall post
        """

        self.initialize()

        wallpost = ShortReview()
        wallpost.user = self.u1
        wallpost.review_text = "sialala bumcyk cyk"
        wallpost.status = Object.PUBLIC_STATUS
        wallpost.kind = ShortReview.WALLPOST
        wallpost.type = Object.TYPE_SHORT_REVIEW
        wallpost.save()

        permalink = 'http://%s.%s/%s/%s/' % (self.u1.username, settings.DOMAIN, urls['WALL'], wallpost.id)
        wp = ShortReview.objects.all()[0]

        self.failUnlessEqual(wp.get_absolute_url(), permalink)
        self.failUnlessEqual(wp.user, wallpost.user)
        self.failUnlessEqual(wp.review_text, "sialala bumcyk cyk")
        self.failUnlessEqual(wp.status, Object.PUBLIC_STATUS)
        self.failUnlessEqual(wp.type, Object.TYPE_SHORT_REVIEW)
示例#17
0
    def test_planet_tag(self):
        # --- Initialize ---
        self.initialize()
        helper_without_tags = PlanetTagHelper()
        helper_with_tags = PlanetTagHelper(tag='comedy')
        recom_helper = RecomHelper()
        user_activity_helper = UserActivityHelper()

        # --- setup followers ---
        self.u1.followers.follow(self.u2)
        self.u1.followers.follow(self.u3)
        self.u1.followers.follow(self.u4)

        # similar users
        from film20.recommendations.bot_helper import do_create_comparators
        self.films_for_comparator()
        do_create_comparators()

        friends_list = recom_helper.get_following_ids_as_list(self.u1)
        friends_without_activities = helper_without_tags.planet_tag_friends(friends_list)
        self.assertEquals(len(friends_without_activities), 0)
        
        similar_users_list = user_activity_helper.get_similar_users_list(request)
        similar_users_without_tags = helper_without_tags.planet_tag_similar_users(similar_users_list)
        self.assertEquals(len(similar_users_without_tags), 0)

        notes_without_tags = helper_without_tags.planet_tag_notes()
        self.assertEquals(len(notes_without_tags), 0)

        all_planet_activities = helper_without_tags.planet_tag_all()
        self.assertEquals(len(all_planet_activities), 0)

        # --- setup User activities ---
        post = Post()
        post.title = "Lorem ipsum"
        post.permalink = "lorem-ipsum"
        post.body = "siala lala tralala"
        post.user = self.u1
        post.status = Object.PUBLIC_STATUS
        post.type = Object.TYPE_POST
        post.save()
        post.related_film.add(self.film)
        post.save()
        
        all_activities = helper_without_tags.planet_tag_all()
        self.assertEquals(len(all_activities), 1)
        
        post = Post()
        post.title = "Lorem ipsum"
        post.permalink = "lorem-ipsum"
        post.body = "siala lala tralala"
        post.user = self.u1
        post.status = Object.PUBLIC_STATUS
        post.type = Object.TYPE_POST
        post.save()
        post.related_film.add(self.film1)
        post.save()
        
        all_activities = helper_without_tags.planet_tag_all()
        self.assertEquals(len(all_activities), 2)
                
        obj = Object.objects.get(id=self.film2.id)
        shortreview = ShortReview()
        shortreview.user = self.u1
        shortreview.review_text = "sialala bumcyk cyk"
        shortreview.status = Object.PUBLIC_STATUS
        shortreview.type = Object.TYPE_SHORT_REVIEW
        shortreview.object = obj
        shortreview.kind = ShortReview.REVIEW
        shortreview.save()

        all_activities = helper_without_tags.planet_tag_all()
        self.assertEquals(len(all_activities), 3)
        
        # Activities with 'comedy' tag
        all_activities_with_tags = helper_with_tags.planet_tag_all()
        self.assertEquals(len(all_activities_with_tags), 1)

        # --- setup followers activities ---
        post = Post()
        post.title = "#1 Lorem ipsum"
        post.permalink = "lorem-ipsum"
        post.body = "siala lala tralala"
        post.user = self.u2
        post.status = Object.PUBLIC_STATUS
        post.type = Object.TYPE_POST
        post.save()
        post.related_film.add(self.film)
        post.save()

        all_activities = helper_without_tags.planet_tag_all()
        self.assertEquals(len(all_activities), 4)

        post = Post()
        post.title = "#2 Lorem ipsum"
        post.permalink = "lorem-ipsum"
        post.body = "siala lala tralala"
        post.user = self.u3
        post.status = Object.PUBLIC_STATUS
        post.type = Object.TYPE_POST
        post.save()
        post.related_film.add(self.film1)
        post.save()

        all_activities = helper_without_tags.planet_tag_all()
        self.assertEquals(len(all_activities), 5)

        obj = Object.objects.get(id=self.film2.id)
        shortreview = ShortReview()
        shortreview.user = self.u4
        shortreview.review_text = "sialala bumcyk cyk"
        shortreview.status = Object.PUBLIC_STATUS
        shortreview.type = Object.TYPE_SHORT_REVIEW
        shortreview.object = obj
        shortreview.kind = ShortReview.REVIEW
        shortreview.save()

        all_activities = helper_without_tags.planet_tag_all()
        self.assertEquals(len(all_activities), 6)

        activities_with_tags = helper_with_tags.planet_tag_all()
        self.assertEquals(len(activities_with_tags), 2)

        all_friends_activities = helper_without_tags.planet_tag_friends(friends_list)
        self.assertEquals(len(all_friends_activities), 3)
        friends_activities_with_tag = helper_with_tags.planet_tag_friends(friends_list)
        self.assertEquals(len(friends_activities_with_tag), 1)

        # --- Check notes ---
        all_planet_notes = helper_without_tags.planet_tag_notes()
        self.assertEquals(len(all_planet_notes), 4)

        # Post notes with 'comedy' tag
        notes_activities_with_tag = helper_with_tags.planet_tag_notes()
        self.assertEquals(len(notes_activities_with_tag), 2)

        similar_users_activities = helper_without_tags.planet_tag_similar_users(similar_users_list)
        self.assertEquals(len(similar_users_activities), 2)

        users_with_tags = helper_with_tags.planet_tag_similar_users(similar_users_list)
        self.assertEquals(len(users_with_tags), 1)
        
        activities = UserActivity.objects.all() 
示例#18
0
    def test_planet_tag(self):
        # --- Initialize ---
        self.initialize()
        helper_without_tags = PlanetTagHelper()
        helper_with_tags = PlanetTagHelper(tag='comedy')
        recom_helper = RecomHelper()
        user_activity_helper = UserActivityHelper()

        # --- setup followers ---
        self.u1.followers.follow(self.u2)
        self.u1.followers.follow(self.u3)
        self.u1.followers.follow(self.u4)

        # similar users
        from film20.recommendations.bot_helper import do_create_comparators
        self.films_for_comparator()
        do_create_comparators()

        friends_list = recom_helper.get_following_ids_as_list(self.u1)
        friends_without_activities = helper_without_tags.planet_tag_friends(
            friends_list)
        self.assertEquals(len(friends_without_activities), 0)

        similar_users_list = user_activity_helper.get_similar_users_list(
            request)
        similar_users_without_tags = helper_without_tags.planet_tag_similar_users(
            similar_users_list)
        self.assertEquals(len(similar_users_without_tags), 0)

        notes_without_tags = helper_without_tags.planet_tag_notes()
        self.assertEquals(len(notes_without_tags), 0)

        all_planet_activities = helper_without_tags.planet_tag_all()
        self.assertEquals(len(all_planet_activities), 0)

        # --- setup User activities ---
        post = Post()
        post.title = "Lorem ipsum"
        post.permalink = "lorem-ipsum"
        post.body = "siala lala tralala"
        post.user = self.u1
        post.status = Object.PUBLIC_STATUS
        post.type = Object.TYPE_POST
        post.save()
        post.related_film.add(self.film)
        post.save()

        all_activities = helper_without_tags.planet_tag_all()
        self.assertEquals(len(all_activities), 1)

        post = Post()
        post.title = "Lorem ipsum"
        post.permalink = "lorem-ipsum"
        post.body = "siala lala tralala"
        post.user = self.u1
        post.status = Object.PUBLIC_STATUS
        post.type = Object.TYPE_POST
        post.save()
        post.related_film.add(self.film1)
        post.save()

        all_activities = helper_without_tags.planet_tag_all()
        self.assertEquals(len(all_activities), 2)

        obj = Object.objects.get(id=self.film2.id)
        shortreview = ShortReview()
        shortreview.user = self.u1
        shortreview.review_text = "sialala bumcyk cyk"
        shortreview.status = Object.PUBLIC_STATUS
        shortreview.type = Object.TYPE_SHORT_REVIEW
        shortreview.object = obj
        shortreview.kind = ShortReview.REVIEW
        shortreview.save()

        all_activities = helper_without_tags.planet_tag_all()
        self.assertEquals(len(all_activities), 3)

        # Activities with 'comedy' tag
        all_activities_with_tags = helper_with_tags.planet_tag_all()
        self.assertEquals(len(all_activities_with_tags), 1)

        # --- setup followers activities ---
        post = Post()
        post.title = "#1 Lorem ipsum"
        post.permalink = "lorem-ipsum"
        post.body = "siala lala tralala"
        post.user = self.u2
        post.status = Object.PUBLIC_STATUS
        post.type = Object.TYPE_POST
        post.save()
        post.related_film.add(self.film)
        post.save()

        all_activities = helper_without_tags.planet_tag_all()
        self.assertEquals(len(all_activities), 4)

        post = Post()
        post.title = "#2 Lorem ipsum"
        post.permalink = "lorem-ipsum"
        post.body = "siala lala tralala"
        post.user = self.u3
        post.status = Object.PUBLIC_STATUS
        post.type = Object.TYPE_POST
        post.save()
        post.related_film.add(self.film1)
        post.save()

        all_activities = helper_without_tags.planet_tag_all()
        self.assertEquals(len(all_activities), 5)

        obj = Object.objects.get(id=self.film2.id)
        shortreview = ShortReview()
        shortreview.user = self.u4
        shortreview.review_text = "sialala bumcyk cyk"
        shortreview.status = Object.PUBLIC_STATUS
        shortreview.type = Object.TYPE_SHORT_REVIEW
        shortreview.object = obj
        shortreview.kind = ShortReview.REVIEW
        shortreview.save()

        all_activities = helper_without_tags.planet_tag_all()
        self.assertEquals(len(all_activities), 6)

        activities_with_tags = helper_with_tags.planet_tag_all()
        self.assertEquals(len(activities_with_tags), 2)

        all_friends_activities = helper_without_tags.planet_tag_friends(
            friends_list)
        self.assertEquals(len(all_friends_activities), 3)
        friends_activities_with_tag = helper_with_tags.planet_tag_friends(
            friends_list)
        self.assertEquals(len(friends_activities_with_tag), 1)

        # --- Check notes ---
        all_planet_notes = helper_without_tags.planet_tag_notes()
        self.assertEquals(len(all_planet_notes), 4)

        # Post notes with 'comedy' tag
        notes_activities_with_tag = helper_with_tags.planet_tag_notes()
        self.assertEquals(len(notes_activities_with_tag), 2)

        similar_users_activities = helper_without_tags.planet_tag_similar_users(
            similar_users_list)
        self.assertEquals(len(similar_users_activities), 2)

        users_with_tags = helper_with_tags.planet_tag_similar_users(
            similar_users_list)
        self.assertEquals(len(users_with_tags), 1)

        activities = UserActivity.objects.all()