added test for total comments.

svn path=/plone.app.discussion/trunk/; revision=27033
This commit is contained in:
Timo Stollenwerk 2009-05-20 15:39:45 +00:00
parent 7d79304b33
commit a279520592

View File

@ -55,10 +55,36 @@ class ConversationTest(PloneTestCase):
pass pass
def test_total_comments(self): def test_total_comments(self):
pass # 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)
# Add a three comment. Note: in real life, we always create comments via the factory
# to allow different factories to be swapped in
comment1 = createObject('plone.Comment')
comment1.title = 'Comment 1'
comment1.text = 'Comment text'
comment2 = createObject('plone.Comment')
comment2.title = 'Comment 2'
comment2.text = 'Comment text'
comment3 = createObject('plone.Comment')
comment3.title = 'Comment 3'
comment3.text = 'Comment text'
new_comment1_id = conversation.addComment(comment1)
new_comment2_id = conversation.addComment(comment2)
new_comment3_id = conversation.addComment(comment3)
self.assertEquals(len(conversation.getComments()), 3)
def test_commentators(self): def test_commentators(self):
# add and remove a few comments to make sure the commenetators # add and remove a few comments to make sure the commentators
# property returns a true set # property returns a true set
pass pass