Example #1
0
    def test_discussion_feed_with_same_slugs(self):
        """
        https://github.com/gnowgi/django-gstudio/issues/104

        OK, Here I will reproduce the original case: getting a discussion
        type feed, with a same slug.

        The correction of this case, will need some changes in the
        get_object method.
        """
        nodetype = self.create_published_nodetype()

        feed = NodetypeDiscussions()
        self.assertEquals(feed.get_object(
            'request', 2010, 1, 1, nodetype.slug), nodetype)

        params = {'title': 'My test nodetype, part II',
                  'content': 'My content ',
                  'slug': 'my-test-nodetype',
                  'tags': 'tests',
                  'creation_date': datetime(2010, 2, 1),
                  'status': PUBLISHED}
        nodetype_same_slug = Nodetype.objects.create(**params)
        nodetype_same_slug.sites.add(self.site)
        nodetype_same_slug.authors.add(self.author)

        self.assertEquals(feed.get_object(
            'request', 2010, 2, 1, nodetype_same_slug.slug), nodetype_same_slug)
Example #2
0
    def test_discussion_feed_with_same_slugs(self):
        """
        https://github.com/gnowgi/django-gstudio/issues/104

        OK, Here I will reproduce the original case: getting a discussion
        type feed, with a same slug.

        The correction of this case, will need some changes in the
        get_object method.
        """
        nodetype = self.create_published_nodetype()

        feed = NodetypeDiscussions()
        self.assertEquals(
            feed.get_object('request', 2010, 1, 1, nodetype.slug), nodetype)

        params = {
            'title': 'My test nodetype, part II',
            'content': 'My content ',
            'slug': 'my-test-nodetype',
            'tags': 'tests',
            'creation_date': datetime(2010, 2, 1),
            'status': PUBLISHED
        }
        nodetype_same_slug = Nodetype.objects.create(**params)
        nodetype_same_slug.sites.add(self.site)
        nodetype_same_slug.authors.add(self.author)

        self.assertEquals(
            feed.get_object('request', 2010, 2, 1, nodetype_same_slug.slug),
            nodetype_same_slug)
Example #3
0
        name='gstudio_nodetype_latest_feed'),
    url(r'^search/$',
        SearchNodetypes(),
        name='gstudio_nodetype_search_feed'),
    url(r'^tags/(?P<slug>[- \w]+)/$',
        TagNodetypes(),
        name='gstudio_tag_feed'),
    url(r'^authors/(?P<username>[.+-@\w]+)/$',
        AuthorNodetypes(),
        name='gstudio_author_feed'),
    url(r'^metatypes/(?P<path>[-\/\w]+)/$',
        MetatypeNodetypes(),
        name='gstudio_metatype_feed'),
    url(r'^discussions/(?P<year>\d{4})/(?P<month>\d{2})/' \
        '(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
        NodetypeDiscussions(),
        name='gstudio_nodetype_discussion_feed'),
    url(r'^comments/(?P<year>\d{4})/(?P<month>\d{2})/' \
        '(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
        NodetypeComments(),
        name='gstudio_nodetype_comment_feed'),
    url(r'^pingbacks/(?P<year>\d{4})/(?P<month>\d{2})/' \
        '(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
        NodetypePingbacks(),
        name='gstudio_nodetype_pingback_feed'),
    url(r'^trackbacks/(?P<year>\d{4})/(?P<month>\d{2})/' \
        '(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
        NodetypeTrackbacks(),
        name='gstudio_nodetype_trackback_feed'),
    )
Example #4
0
 def test_nodetype_discussions(self):
     nodetype = self.create_published_nodetype()
     comments = self.create_discussions(nodetype)
     feed = NodetypeDiscussions()
     self.assertEquals(feed.get_object(
         'request', 2010, 1, 1, nodetype.slug), nodetype)
     self.assertEquals(feed.link(nodetype), '/2010/01/01/my-test-nodetype/')
     self.assertEquals(len(feed.items(nodetype)), 3)
     self.assertEquals(feed.item_pubdate(comments[0]),
                       comments[0].submit_date)
     self.assertEquals(feed.item_link(comments[0]),
                       '/comments/cr/%i/1/#c1' % self.nodetype_ct_id)
     self.assertEquals(feed.item_author_name(comments[0]), 'admin')
     self.assertEquals(feed.item_author_email(comments[0]),
                       '*****@*****.**')
     self.assertEquals(feed.item_author_link(comments[0]), '')
     self.assertEquals(feed.title(nodetype),
                       _('Discussions on %s') % nodetype.title)
     self.assertEquals(
         feed.description(nodetype),
         _('The latest discussions for the nodetype %s') % nodetype.title)
Example #5
0
 def test_nodetype_discussions(self):
     nodetype = self.create_published_nodetype()
     comments = self.create_discussions(nodetype)
     feed = NodetypeDiscussions()
     self.assertEquals(
         feed.get_object('request', 2010, 1, 1, nodetype.slug), nodetype)
     self.assertEquals(feed.link(nodetype), '/2010/01/01/my-test-nodetype/')
     self.assertEquals(len(feed.items(nodetype)), 3)
     self.assertEquals(feed.item_pubdate(comments[0]),
                       comments[0].submit_date)
     self.assertEquals(feed.item_link(comments[0]),
                       '/comments/cr/%i/1/#c1' % self.nodetype_ct_id)
     self.assertEquals(feed.item_author_name(comments[0]), 'admin')
     self.assertEquals(feed.item_author_email(comments[0]),
                       '*****@*****.**')
     self.assertEquals(feed.item_author_link(comments[0]), '')
     self.assertEquals(feed.title(nodetype),
                       _('Discussions on %s') % nodetype.title)
     self.assertEquals(
         feed.description(nodetype),
         _('The latest discussions for the nodetype %s') % nodetype.title)