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