From a948f1597115ee704f6623786ebda81ebd98021b Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Sun, 24 May 2009 16:23:49 +0000 Subject: [PATCH] test delete comment for IReplies added. svn path=/plone.app.discussion/trunk/; revision=27094 --- .../app/discussion/tests/test_conversation.py | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/plone/app/discussion/tests/test_conversation.py b/plone/app/discussion/tests/test_conversation.py index b3030dc..aecdd67 100644 --- a/plone/app/discussion/tests/test_conversation.py +++ b/plone/app/discussion/tests/test_conversation.py @@ -495,7 +495,33 @@ class RepliesTest(PloneTestCase): self.assertEquals(conversation[new_id].comment_id, new_id) def test_delete_comment(self): - pass + # Create and remove a comment and check if the replies adapter + # has been updated accordingly + + # Create a conversation. In this case we doesn't assign it to an + # object, as we just want to check the Conversation object API. + conversation = IConversation(self.portal.doc1) + + # Pretend that we have traversed to the comment by aq wrapping it. + conversation = conversation.__of__(self.portal.doc1) + + replies = IReplies(conversation) + + # Add a comment. + comment = createObject('plone.Comment') + comment.title = 'Comment 1' + comment.text = 'Comment text' + + new_id = replies.addComment(comment) + + # make sure the comment has been added + self.assertEquals(len(replies), 1) + + # delete the comment we just created + del replies[new_id] + + # make sure there is no comment left in the conversation + self.assertEquals(len(replies), 0) def test_dict_api(self): # Ensure all operations use only top-level comments. Add some