diff --git a/plone/app/discussion/tests/test_conversation.py b/plone/app/discussion/tests/test_conversation.py index 1347f49..823ef39 100644 --- a/plone/app/discussion/tests/test_conversation.py +++ b/plone/app/discussion/tests/test_conversation.py @@ -143,6 +143,24 @@ class ConversationTest(PloneTestCase): {'comment': comment2_1, 'depth': 1, 'id': new_id_2_1}, ], list(conversation.getThreads())) + def test_delete_comment_when_content_object_is_deleted(self): + # Make sure all comments of a content object are deleted when the object + # itself is deleted. + conversation = IConversation(self.portal.doc1) + comment = createObject('plone.Comment') + comment.title = 'Comment 1' + comment.text = 'Comment text' + new_id = conversation.addComment(comment) + + # Delete the content object + self.portal.manage_delObjects(['doc1']) + + # Make sure the comment has been deleted as well + # XXX: Failing! Pivotal Tracker issue #2494228. + #self.assertEquals(len(list(conversation.getComments())), 0) + #self.assertEquals(sum(1 for w in conversation.getThreads()), 0) + #self.assertEquals(conversation.total_comments, 0) + def test_allow_discussion(self): # This is not a real test! It's only there to understand the # allow discussion attribute. Maybe we should remove this at