Exemple #1
0
    def test_saving_externallink_activity(self):
        """
            Test saving externallink activity
        """

        self.initialize()

        # set up Externallink

        ext = ExternalLink()
        ext.title = "Link title!"
        ext.url = "http://filmaster.pl"
        ext.url_kind = ExternalLink.REVIEW
        ext.excerpt = "Lorem ipsum"
        ext.film = self.film
        ext.user = self.u1
        ext.status = Object.PUBLIC_STATUS
        ext.type = Object.TYPE_LINK
        ext.save()

        self.assertRaises(UserActivity.DoesNotExist,
                          UserActivity.objects.get,
                          link=ext)

        ext.moderation_status = ExternalLink.STATUS_ACCEPTED
        ext.save()

        activity = UserActivity.objects.get(link=ext)

        # testing if activity was saved properly
        self.failUnlessEqual(activity.title, ext.title)
        self.failUnlessEqual(activity.content, ext.excerpt)
        self.failUnlessEqual(activity.get_absolute_url(),
                             ext.get_absolute_url())
        self.failUnlessEqual(activity.status, ext.status)
        self.failUnlessEqual(activity.activity_type, UserActivity.TYPE_LINK)
        self.failUnlessEqual(activity.username, self.u1.username)
        self.failUnlessEqual(activity.film_title, self.film.title)
        self.failUnlessEqual(activity.film_permalink, self.film.permalink)
Exemple #2
0
    def test_updating_externallink_activity(self):
        """
            Test updating externallink activity
        """

        self.initialize()

        # set up Externallink

        ext = ExternalLink()
        ext.title = "Link title!"
        ext.url = "http://filmaster.pl"
        ext.url_kind = ExternalLink.REVIEW
        ext.excerpt = "Lorem ipsum"
        ext.film = self.film
        ext.user = self.u1
        ext.status = Object.PUBLIC_STATUS
        ext.type = Object.TYPE_LINK
        ext.save()

        ext.url = "http://osnews.pl"
        ext.excerpt = "Lorem lorem"
        ext.save()

        activity = UserActivity.objects.get(link=ext)

        # testing if activity was saved properly
        self.failUnlessEqual(activity.title, ext.title)
        self.failUnlessEqual(activity.content, "Lorem lorem")
        self.failUnlessEqual(activity.get_absolute_url(),
                             ext.get_absolute_url())
        self.failUnlessEqual(activity.status, ext.status)
        self.failUnlessEqual(activity.url, "http://osnews.pl")
        self.failUnlessEqual(activity.activity_type, UserActivity.TYPE_LINK)
        self.failUnlessEqual(activity.username, self.u1.username)
        self.failUnlessEqual(activity.film_title, self.film.title)
        self.failUnlessEqual(activity.film_permalink, self.film.permalink)
Exemple #3
0
    def test_updating_externallink_activity(self):
        """
            Test updating externallink activity
        """

        self.initialize()

        # set up Externallink

        ext = ExternalLink()
        ext.title = "Link title!"
        ext.url = "http://filmaster.pl"
        ext.url_kind = ExternalLink.REVIEW
        ext.excerpt = "Lorem ipsum"
        ext.film = self.film
        ext.user = self.u1
        ext.status = Object.PUBLIC_STATUS
        ext.type = Object.TYPE_LINK
        ext.save()

        ext.url = "http://osnews.pl"
        ext.excerpt = "Lorem lorem"
        ext.save()

        activity = UserActivity.objects.get(link=ext)

        # testing if activity was saved properly
        self.failUnlessEqual(activity.title, ext.title)
        self.failUnlessEqual(activity.content, "Lorem lorem")
        self.failUnlessEqual(activity.get_absolute_url(), ext.get_absolute_url())
        self.failUnlessEqual(activity.status, ext.status)
        self.failUnlessEqual(activity.url, "http://osnews.pl")
        self.failUnlessEqual(activity.activity_type, UserActivity.TYPE_LINK)
        self.failUnlessEqual(activity.username, self.u1.username)
        self.failUnlessEqual(activity.film_title, self.film.title)
        self.failUnlessEqual(activity.film_permalink, self.film.permalink)
Exemple #4
0
    def test_saving_externallink_activity(self):
        """
            Test saving externallink activity
        """

        self.initialize()

        # set up Externallink

        ext = ExternalLink()
        ext.title = "Link title!"
        ext.url = "http://filmaster.pl"
        ext.url_kind = ExternalLink.REVIEW
        ext.excerpt = "Lorem ipsum"
        ext.film = self.film
        ext.user = self.u1
        ext.status = Object.PUBLIC_STATUS
        ext.type = Object.TYPE_LINK
        ext.save()

        self.assertRaises(UserActivity.DoesNotExist, UserActivity.objects.get, link=ext)
        
        ext.moderation_status = ExternalLink.STATUS_ACCEPTED
        ext.save()

        activity = UserActivity.objects.get(link=ext)

        # testing if activity was saved properly
        self.failUnlessEqual(activity.title, ext.title)
        self.failUnlessEqual(activity.content, ext.excerpt)
        self.failUnlessEqual(activity.get_absolute_url(), ext.get_absolute_url())
        self.failUnlessEqual(activity.status, ext.status)
        self.failUnlessEqual(activity.activity_type, UserActivity.TYPE_LINK)
        self.failUnlessEqual(activity.username, self.u1.username)
        self.failUnlessEqual(activity.film_title, self.film.title)
        self.failUnlessEqual(activity.film_permalink, self.film.permalink)