示例#1
0
    def test_discussion_feed_with_same_slugs(self):
        """
        https://github.com/Fantomas42/django-blog-objectapp/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.
        """
        gbobject = self.create_published_gbobject()

        feed = GbobjectDiscussions()
        self.assertEquals(
            feed.get_object('request', 2010, 1, 1, gbobject.slug), gbobject)

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

        self.assertEquals(
            feed.get_object('request', 2010, 2, 1, gbobject_same_slug.slug),
            gbobject_same_slug)
示例#2
0
    def test_discussion_feed_with_same_slugs(self):
        """
        https://github.com/Fantomas42/django-blog-objectapp/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.
        """
        gbobject = self.create_published_gbobject()

        feed = GbobjectDiscussions()
        self.assertEquals(feed.get_object(
            'request', 2010, 1, 1, gbobject.slug), gbobject)

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

        self.assertEquals(feed.get_object(
            'request', 2010, 2, 1, gbobject_same_slug.slug), gbobject_same_slug)
示例#3
0
 def test_gbobject_discussions(self):
     gbobject = self.create_published_gbobject()
     comments = self.create_discussions(gbobject)
     feed = GbobjectDiscussions()
     self.assertEquals(
         feed.get_object('request', 2010, 1, 1, gbobject.slug), gbobject)
     self.assertEquals(feed.link(gbobject), '/2010/01/01/my-test-gbobject/')
     self.assertEquals(len(feed.items(gbobject)), 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.gbobject_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(gbobject),
                       _('Discussions on %s') % gbobject.title)
     self.assertEquals(
         feed.description(gbobject),
         _('The latest discussions for the gbobject %s') % gbobject.title)
示例#4
0
 def test_gbobject_discussions(self):
     gbobject = self.create_published_gbobject()
     comments = self.create_discussions(gbobject)
     feed = GbobjectDiscussions()
     self.assertEquals(feed.get_object(
         'request', 2010, 1, 1, gbobject.slug), gbobject)
     self.assertEquals(feed.link(gbobject), '/2010/01/01/my-test-gbobject/')
     self.assertEquals(len(feed.items(gbobject)), 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.gbobject_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(gbobject),
                       _('Discussions on %s') % gbobject.title)
     self.assertEquals(
         feed.description(gbobject),
         _('The latest discussions for the gbobject %s') % gbobject.title)
示例#5
0
        name='objectapp_gbobject_latest_feed'),
    url(r'^search/$',
        SearchGbobjects(),
        name='objectapp_gbobject_search_feed'),
    url(r'^tags/(?P<slug>[- \w]+)/$',
        TagGbobjects(),
        name='objectapp_tag_feed'),
    url(r'^authors/(?P<username>[.+-@\w]+)/$',
        AuthorGbobjects(),
        name='objectapp_author_feed'),
    url(r'^objecttypes/(?P<path>[-\/\w]+)/$',
        ObjecttypeGbobjects(),
        name='objectapp_Objecttype_feed'),
    url(r'^discussions/(?P<year>\d{4})/(?P<month>\d{2})/' \
        '(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
        GbobjectDiscussions(),
        name='objectapp_gbobject_discussion_feed'),
    url(r'^comments/(?P<year>\d{4})/(?P<month>\d{2})/' \
        '(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
        GbobjectComments(),
        name='objectapp_gbobject_comment_feed'),
    url(r'^pingbacks/(?P<year>\d{4})/(?P<month>\d{2})/' \
        '(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
        GbobjectPingbacks(),
        name='objectapp_gbobject_pingback_feed'),
    url(r'^trackbacks/(?P<year>\d{4})/(?P<month>\d{2})/' \
        '(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
        GbobjectTrackbacks(),
        name='objectapp_gbobject_trackback_feed'),
    )