test to add a comment to the IReplies adapter on a conversation added. not complete yet!

svn path=/plone.app.discussion/trunk/; revision=27084
This commit is contained in:
Timo Stollenwerk 2009-05-24 12:34:15 +00:00
parent 3733c1fab3
commit 69ab219582

View File

@ -8,7 +8,9 @@ from Acquisition import aq_base, aq_parent
from Products.PloneTestCase.ptc import PloneTestCase from Products.PloneTestCase.ptc import PloneTestCase
from plone.app.discussion.tests.layer import DiscussionLayer from plone.app.discussion.tests.layer import DiscussionLayer
from plone.app.discussion.interfaces import IConversation, IComment from plone.app.discussion.interfaces import IConversation, IComment, IReplies
from plone.app.discussion.conversation import ConversationReplies
class ConversationTest(PloneTestCase): class ConversationTest(PloneTestCase):
@ -325,10 +327,31 @@ class RepliesTest(PloneTestCase):
typetool.constructContent('Document', self.portal, 'doc1') typetool.constructContent('Document', self.portal, 'doc1')
def test_add_comment(self): def test_add_comment(self):
#tisto: replies = IReplies(conversaion) # Add comments to a ConversationReplies adapter
#<optilude> then do stuff like replies.addComment()
#del replies[foo] # Create a conversation. In this case we doesn't assign it to an
pass # 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)
comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text'
new_id = replies.addComment(comment)
# check that replies is a ConversationReplies object
self.assert_(isinstance(replies, ConversationReplies))
# check that replies provides the IReplies interface
self.assert_(IReplies.providedBy(replies))
# TODO: Is this correct? How do I test the ConversationReplies?
# replies.items() is empty!
def test_delete_comment(self): def test_delete_comment(self):
pass pass