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)
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)
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)
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)