There is no need to set the comment title in the tests, since comments do not have title fields anymore.

svn path=/plone.app.discussion/trunk/; revision=44738
This commit is contained in:
Timo Stollenwerk 2010-10-31 11:09:32 +00:00
parent feec103b56
commit a39ac82858
6 changed files with 1 additions and 63 deletions

View File

@ -99,7 +99,6 @@ class CommentTest(PloneTestCase):
conversation = IConversation(self.portal.doc1) conversation = IConversation(self.portal.doc1)
comment1 = createObject('plone.Comment') comment1 = createObject('plone.Comment')
comment1.title = 'Comment 1'
comment1.text = 'Comment text' comment1.text = 'Comment text'
new_comment1_id = conversation.addComment(comment1) new_comment1_id = conversation.addComment(comment1)
@ -107,7 +106,6 @@ class CommentTest(PloneTestCase):
comment = self.portal.doc1.restrictedTraverse( comment = self.portal.doc1.restrictedTraverse(
'++conversation++default/%s' % new_comment1_id) '++conversation++default/%s' % new_comment1_id)
self.assert_(IComment.providedBy(comment)) self.assert_(IComment.providedBy(comment))
self.assertEquals('Comment 1', comment.title)
self.assertEquals(('', 'plone', 'doc1', '++conversation++default', self.assertEquals(('', 'plone', 'doc1', '++conversation++default',
str(new_comment1_id)), comment.getPhysicalPath()) str(new_comment1_id)), comment.getPhysicalPath())
@ -160,7 +158,6 @@ class CommentTest(PloneTestCase):
# Create a comment # Create a comment
comment1 = createObject('plone.Comment') comment1 = createObject('plone.Comment')
comment1.title = 'Comment 1'
comment1.text = 'Comment text' comment1.text = 'Comment text'
# Add comment to the conversation # Add comment to the conversation
@ -204,7 +201,6 @@ class RepliesTest(PloneTestCase):
replies = IReplies(conversation) replies = IReplies(conversation)
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text' comment.text = 'Comment text'
new_id = replies.addComment(comment) new_id = replies.addComment(comment)
comment = self.portal.doc1.restrictedTraverse( comment = self.portal.doc1.restrictedTraverse(
@ -212,7 +208,6 @@ class RepliesTest(PloneTestCase):
# Add a reply to the CommentReplies adapter of the first comment # Add a reply to the CommentReplies adapter of the first comment
re_comment = createObject('plone.Comment') re_comment = createObject('plone.Comment')
re_comment.title = 'Re: Comment 1'
re_comment.text = 'Comment text' re_comment.text = 'Comment text'
replies = IReplies(comment) replies = IReplies(comment)
@ -242,7 +237,6 @@ class RepliesTest(PloneTestCase):
replies = IReplies(conversation) replies = IReplies(conversation)
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text' comment.text = 'Comment text'
new_id = replies.addComment(comment) new_id = replies.addComment(comment)
comment = self.portal.doc1.restrictedTraverse( comment = self.portal.doc1.restrictedTraverse(
@ -250,7 +244,6 @@ class RepliesTest(PloneTestCase):
# Add a reply to the CommentReplies adapter of the first comment # Add a reply to the CommentReplies adapter of the first comment
re_comment = createObject('plone.Comment') re_comment = createObject('plone.Comment')
re_comment.title = 'Re: Comment 1'
re_comment.text = 'Comment text' re_comment.text = 'Comment text'
replies = IReplies(comment) replies = IReplies(comment)
@ -274,13 +267,11 @@ class RepliesTest(PloneTestCase):
conversation = IConversation(self.portal.doc1) conversation = IConversation(self.portal.doc1)
comment1 = createObject('plone.Comment') comment1 = createObject('plone.Comment')
comment1.title = 'Comment 1'
comment1.text = 'Comment text' comment1.text = 'Comment text'
conversation.addComment(comment1) conversation.addComment(comment1)
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text' comment.text = 'Comment text'
new_id = conversation.addComment(comment) new_id = conversation.addComment(comment)
comment = self.portal.doc1.restrictedTraverse( comment = self.portal.doc1.restrictedTraverse(
@ -288,7 +279,6 @@ class RepliesTest(PloneTestCase):
# Add a reply to the CommentReplies adapter of the first comment # Add a reply to the CommentReplies adapter of the first comment
re_comment = createObject('plone.Comment') re_comment = createObject('plone.Comment')
re_comment.title = 'Re: Comment 1'
re_comment.text = 'Comment text' re_comment.text = 'Comment text'
replies = IReplies(comment) replies = IReplies(comment)
new_re_id = replies.addComment(re_comment) new_re_id = replies.addComment(re_comment)
@ -297,7 +287,6 @@ class RepliesTest(PloneTestCase):
# Add a reply to the reply # Add a reply to the reply
re_re_comment = createObject('plone.Comment') re_re_comment = createObject('plone.Comment')
re_re_comment.title = 'Re: Re: Comment 1'
re_re_comment.text = 'Comment text' re_re_comment.text = 'Comment text'
replies = IReplies(re_comment) replies = IReplies(re_comment)
new_re_re_id = replies.addComment(re_re_comment) new_re_re_id = replies.addComment(re_re_comment)
@ -306,7 +295,6 @@ class RepliesTest(PloneTestCase):
# Add a reply to the replies reply # Add a reply to the replies reply
re_re_re_comment = createObject('plone.Comment') re_re_re_comment = createObject('plone.Comment')
re_re_re_comment.title = 'Re: Re: Comment 1'
re_re_re_comment.text = 'Comment text' re_re_re_comment.text = 'Comment text'
replies = IReplies(re_re_comment) replies = IReplies(re_re_comment)
new_re_re_re_id = replies.addComment(re_re_re_comment) new_re_re_re_id = replies.addComment(re_re_re_comment)

View File

@ -42,7 +42,6 @@ class ConversationTest(PloneTestCase):
# factory to allow different factories to be swapped in # factory to allow different factories to be swapped in
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text' comment.text = 'Comment text'
new_id = conversation.addComment(comment) new_id = conversation.addComment(comment)
@ -68,7 +67,6 @@ class ConversationTest(PloneTestCase):
# factory to allow different factories to be swapped in # factory to allow different factories to be swapped in
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text' comment.text = 'Comment text'
new_id = conversation.addComment(comment) new_id = conversation.addComment(comment)
@ -105,27 +103,21 @@ class ConversationTest(PloneTestCase):
# Create all comments # Create all comments
comment1 = createObject('plone.Comment') comment1 = createObject('plone.Comment')
comment1.title = 'Comment 1'
comment1.text = 'Comment text' comment1.text = 'Comment text'
comment1_1 = createObject('plone.Comment') comment1_1 = createObject('plone.Comment')
comment1_1.title = 'Re: Comment 1'
comment1_1.text = 'Comment text' comment1_1.text = 'Comment text'
comment1_1_1 = createObject('plone.Comment') comment1_1_1 = createObject('plone.Comment')
comment1_1_1.title = 'Re: Re: Comment 1'
comment1_1_1.text = 'Comment text' comment1_1_1.text = 'Comment text'
comment1_2 = createObject('plone.Comment') comment1_2 = createObject('plone.Comment')
comment1_2.title = 'Re: Comment 1 (2)'
comment1_2.text = 'Comment text' comment1_2.text = 'Comment text'
comment2 = createObject('plone.Comment') comment2 = createObject('plone.Comment')
comment2.title = 'Comment 2'
comment2.text = 'Comment text' comment2.text = 'Comment text'
comment2_1 = createObject('plone.Comment') comment2_1 = createObject('plone.Comment')
comment2_1.title = 'Re: Comment 2'
comment2_1.text = 'Comment text' comment2_1.text = 'Comment text'
# Create the nested comment structure # Create the nested comment structure
@ -156,7 +148,6 @@ class ConversationTest(PloneTestCase):
# object itself is deleted. # object itself is deleted.
conversation = IConversation(self.portal.doc1) conversation = IConversation(self.portal.doc1)
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text' comment.text = 'Comment text'
conversation.addComment(comment) conversation.addComment(comment)
@ -418,13 +409,11 @@ class ConversationTest(PloneTestCase):
# factory to allow different factories to be swapped in # factory to allow different factories to be swapped in
comment1 = createObject('plone.Comment') comment1 = createObject('plone.Comment')
comment1.title = 'Comment 1'
comment1.text = 'Comment text' comment1.text = 'Comment text'
new_id1 = conversation.addComment(comment1) new_id1 = conversation.addComment(comment1)
comment2 = createObject('plone.Comment') comment2 = createObject('plone.Comment')
comment2.title = 'Comment 2'
comment2.text = 'Comment text' comment2.text = 'Comment text'
new_id2 = conversation.addComment(comment2) new_id2 = conversation.addComment(comment2)
@ -477,15 +466,12 @@ class ConversationTest(PloneTestCase):
# swapped in # swapped in
comment1 = createObject('plone.Comment') comment1 = createObject('plone.Comment')
comment1.title = 'Comment 1'
comment1.text = 'Comment text' comment1.text = 'Comment text'
comment2 = createObject('plone.Comment') comment2 = createObject('plone.Comment')
comment2.title = 'Comment 2'
comment2.text = 'Comment text' comment2.text = 'Comment text'
comment3 = createObject('plone.Comment') comment3 = createObject('plone.Comment')
comment3.title = 'Comment 3'
comment3.text = 'Comment text' comment3.text = 'Comment text'
conversation.addComment(comment1) conversation.addComment(comment1)
@ -509,25 +495,21 @@ class ConversationTest(PloneTestCase):
# comments via the factory to allow different factories to be # comments via the factory to allow different factories to be
# swapped in # swapped in
comment1 = createObject('plone.Comment') comment1 = createObject('plone.Comment')
comment1.title = 'Comment 1'
comment1.text = 'Comment text' comment1.text = 'Comment text'
comment1.author_username = "Jim" comment1.author_username = "Jim"
conversation.addComment(comment1) conversation.addComment(comment1)
comment2 = createObject('plone.Comment') comment2 = createObject('plone.Comment')
comment2.title = 'Comment 2'
comment2.text = 'Comment text' comment2.text = 'Comment text'
comment2.author_username = "Joe" comment2.author_username = "Joe"
conversation.addComment(comment2) conversation.addComment(comment2)
comment3 = createObject('plone.Comment') comment3 = createObject('plone.Comment')
comment3.title = 'Comment 3'
comment3.text = 'Comment text' comment3.text = 'Comment text'
comment3.author_username = "Jack" comment3.author_username = "Jack"
new_comment3_id = conversation.addComment(comment3) new_comment3_id = conversation.addComment(comment3)
comment4 = createObject('plone.Comment') comment4 = createObject('plone.Comment')
comment4.title = 'Comment 3'
comment4.text = 'Comment text' comment4.text = 'Comment text'
comment4.author_username = "Jack" comment4.author_username = "Jack"
new_comment4_id = conversation.addComment(comment4) new_comment4_id = conversation.addComment(comment4)
@ -570,19 +552,16 @@ class ConversationTest(PloneTestCase):
# comments via the factory to allow different factories to be # comments via the factory to allow different factories to be
# swapped in # swapped in
comment1 = createObject('plone.Comment') comment1 = createObject('plone.Comment')
comment1.title = 'Comment 1'
comment1.text = 'Comment text' comment1.text = 'Comment text'
comment1.creation_date = datetime.utcnow() - timedelta(4) comment1.creation_date = datetime.utcnow() - timedelta(4)
conversation.addComment(comment1) conversation.addComment(comment1)
comment2 = createObject('plone.Comment') comment2 = createObject('plone.Comment')
comment2.title = 'Comment 2'
comment2.text = 'Comment text' comment2.text = 'Comment text'
comment2.creation_date = datetime.utcnow() - timedelta(2) comment2.creation_date = datetime.utcnow() - timedelta(2)
new_comment2_id = conversation.addComment(comment2) new_comment2_id = conversation.addComment(comment2)
comment3 = createObject('plone.Comment') comment3 = createObject('plone.Comment')
comment3.title = 'Comment 3'
comment3.text = 'Comment text' comment3.text = 'Comment text'
comment3.creation_date = datetime.utcnow() - timedelta(1) comment3.creation_date = datetime.utcnow() - timedelta(1)
new_comment3_id = conversation.addComment(comment3) new_comment3_id = conversation.addComment(comment3)
@ -639,27 +618,21 @@ class ConversationTest(PloneTestCase):
# Create all comments # Create all comments
comment1 = createObject('plone.Comment') comment1 = createObject('plone.Comment')
comment1.title = 'Comment 1'
comment1.text = 'Comment text' comment1.text = 'Comment text'
comment1_1 = createObject('plone.Comment') comment1_1 = createObject('plone.Comment')
comment1_1.title = 'Re: Comment 1'
comment1_1.text = 'Comment text' comment1_1.text = 'Comment text'
comment1_1_1 = createObject('plone.Comment') comment1_1_1 = createObject('plone.Comment')
comment1_1_1.title = 'Re: Re: Comment 1'
comment1_1_1.text = 'Comment text' comment1_1_1.text = 'Comment text'
comment1_2 = createObject('plone.Comment') comment1_2 = createObject('plone.Comment')
comment1_2.title = 'Re: Comment 1 (2)'
comment1_2.text = 'Comment text' comment1_2.text = 'Comment text'
comment2 = createObject('plone.Comment') comment2 = createObject('plone.Comment')
comment2.title = 'Comment 2'
comment2.text = 'Comment text' comment2.text = 'Comment text'
comment2_1 = createObject('plone.Comment') comment2_1 = createObject('plone.Comment')
comment2_1.title = 'Re: Comment 2'
comment2_1.text = 'Comment text' comment2_1.text = 'Comment text'
# Create the nested comment structure # Create the nested comment structure
@ -751,7 +724,6 @@ class RepliesTest(PloneTestCase):
replies = IReplies(conversation) replies = IReplies(conversation)
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text' comment.text = 'Comment text'
new_id = replies.addComment(comment) new_id = replies.addComment(comment)
@ -779,7 +751,6 @@ class RepliesTest(PloneTestCase):
# Add a comment. # Add a comment.
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text' comment.text = 'Comment text'
new_id = replies.addComment(comment) new_id = replies.addComment(comment)
@ -819,27 +790,21 @@ class RepliesTest(PloneTestCase):
# Create all comments # Create all comments
comment1 = createObject('plone.Comment') comment1 = createObject('plone.Comment')
comment1.title = 'Comment 1'
comment1.text = 'Comment text' comment1.text = 'Comment text'
comment1_1 = createObject('plone.Comment') comment1_1 = createObject('plone.Comment')
comment1_1.title = 'Re: Comment 1'
comment1_1.text = 'Comment text' comment1_1.text = 'Comment text'
comment1_1_1 = createObject('plone.Comment') comment1_1_1 = createObject('plone.Comment')
comment1_1_1.title = 'Re: Re: Comment 1'
comment1_1_1.text = 'Comment text' comment1_1_1.text = 'Comment text'
comment1_2 = createObject('plone.Comment') comment1_2 = createObject('plone.Comment')
comment1_2.title = 'Re: Comment 1 (2)'
comment1_2.text = 'Comment text' comment1_2.text = 'Comment text'
comment2 = createObject('plone.Comment') comment2 = createObject('plone.Comment')
comment2.title = 'Comment 2'
comment2.text = 'Comment text' comment2.text = 'Comment text'
comment2_1 = createObject('plone.Comment') comment2_1 = createObject('plone.Comment')
comment2_1.title = 'Re: Comment 2'
comment2_1.text = 'Comment text' comment2_1.text = 'Comment text'
# Create the nested comment structure # Create the nested comment structure

View File

@ -216,7 +216,7 @@ class ModerationBulkActionsViewTest(PloneTestCase):
self.assertEquals(self.conversation.total_comments, 1) self.assertEquals(self.conversation.total_comments, 1)
comment = self.conversation.getComments().next() comment = self.conversation.getComments().next()
self.failUnless(comment) self.failUnless(comment)
self.assertEquals(comment.title, 'Comment 2') self.assertEquals(comment, self.comment2)
def test_suite(): def test_suite():
return unittest.defaultTestLoader.loadTestsFromName(__name__) return unittest.defaultTestLoader.loadTestsFromName(__name__)

View File

@ -57,14 +57,12 @@ class TestUserNotificationUnit(PloneTestCase):
# Add a comment with user notification enabled. Add another comment # Add a comment with user notification enabled. Add another comment
# and make sure an email is send to the user of the first comment. # and make sure an email is send to the user of the first comment.
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text' comment.text = 'Comment text'
comment.user_notification = True comment.user_notification = True
comment.author_email = "john@plone.test" comment.author_email = "john@plone.test"
self.conversation.addComment(comment) self.conversation.addComment(comment)
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 2'
comment.text = 'Comment text' comment.text = 'Comment text'
self.conversation.addComment(comment) self.conversation.addComment(comment)
self.assertEquals(len(self.mailhost.messages), 1) self.assertEquals(len(self.mailhost.messages), 1)
@ -91,14 +89,12 @@ class TestUserNotificationUnit(PloneTestCase):
'user_notification_enabled'] = False 'user_notification_enabled'] = False
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text' comment.text = 'Comment text'
comment.user_notification = True comment.user_notification = True
comment.author_email = "john@plone.test" comment.author_email = "john@plone.test"
self.conversation.addComment(comment) self.conversation.addComment(comment)
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 2'
comment.text = 'Comment text' comment.text = 'Comment text'
self.conversation.addComment(comment) self.conversation.addComment(comment)
@ -106,13 +102,11 @@ class TestUserNotificationUnit(PloneTestCase):
def test_do_not_notify_user_when_email_address_is_given(self): def test_do_not_notify_user_when_email_address_is_given(self):
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text' comment.text = 'Comment text'
comment.user_notification = True comment.user_notification = True
self.conversation.addComment(comment) self.conversation.addComment(comment)
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 2'
comment.text = 'Comment text' comment.text = 'Comment text'
self.conversation.addComment(comment) self.conversation.addComment(comment)
@ -124,14 +118,12 @@ class TestUserNotificationUnit(PloneTestCase):
self.portal.email_from_address = None self.portal.email_from_address = None
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text' comment.text = 'Comment text'
comment.user_notification = True comment.user_notification = True
comment.author_email = "john@plone.test" comment.author_email = "john@plone.test"
self.conversation.addComment(comment) self.conversation.addComment(comment)
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 2'
comment.text = 'Comment text' comment.text = 'Comment text'
self.conversation.addComment(comment) self.conversation.addComment(comment)
@ -181,7 +173,6 @@ class TestModeratorNotificationUnit(PloneTestCase):
def test_notify_moderator(self): def test_notify_moderator(self):
# Add a comment and make sure an email is send to the moderator. # Add a comment and make sure an email is send to the moderator.
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text' comment.text = 'Comment text'
self.conversation.addComment(comment) self.conversation.addComment(comment)
@ -215,7 +206,6 @@ class TestModeratorNotificationUnit(PloneTestCase):
self.portal.email_from_address = None self.portal.email_from_address = None
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text' comment.text = 'Comment text'
self.conversation.addComment(comment) self.conversation.addComment(comment)
self.assertEquals(len(self.mailhost.messages), 0) self.assertEquals(len(self.mailhost.messages), 0)
@ -228,7 +218,6 @@ class TestModeratorNotificationUnit(PloneTestCase):
'moderator_notification_enabled'] = False 'moderator_notification_enabled'] = False
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text' comment.text = 'Comment text'
self.conversation.addComment(comment) self.conversation.addComment(comment)
self.assertEquals(len(self.mailhost.messages), 0) self.assertEquals(len(self.mailhost.messages), 0)
@ -242,7 +231,6 @@ class TestModeratorNotificationUnit(PloneTestCase):
('one_state_workflow',)) ('one_state_workflow',))
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text' comment.text = 'Comment text'
self.conversation.addComment(comment) self.conversation.addComment(comment)
self.assertEquals(len(self.mailhost.messages), 0) self.assertEquals(len(self.mailhost.messages), 0)

View File

@ -25,7 +25,6 @@ class ToolTest(PloneTestCase):
# Add a comment. # Add a comment.
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.creator = 'Jim' comment.creator = 'Jim'
comment.text = 'Comment text' comment.text = 'Comment text'

View File

@ -78,7 +78,6 @@ class CommentOneStateWorkflowTest(PloneTestCase):
# Add a comment # Add a comment
conversation = IConversation(self.folder.doc1) conversation = IConversation(self.folder.doc1)
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text' comment.text = 'Comment text'
cid = conversation.addComment(comment) cid = conversation.addComment(comment)
@ -146,7 +145,6 @@ class CommentReviewWorkflowTest(PloneTestCase):
# Add a comment. # Add a comment.
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text' comment.text = 'Comment text'
comment_id = conversation.addComment(comment) comment_id = conversation.addComment(comment)
comment = self.portal.doc1.restrictedTraverse( comment = self.portal.doc1.restrictedTraverse(