Fix comment title for anonymous commentators that do not provide a name.

svn path=/plone.app.discussion/trunk/; revision=40435
This commit is contained in:
Timo Stollenwerk
2010-09-29 10:52:11 +00:00
parent 2cce7e0d0f
commit 22db0b1c78
3 changed files with 26 additions and 4 deletions
@@ -232,6 +232,20 @@ class CommentCatalogTest(PloneTestCase):
def test_title(self):
self.assertEquals(self.comment_brain.Title, 'Jim on Document 1')
def test_no_name_title(self):
comment = createObject('plone.Comment')
comment.text = 'Comment text'
cid = self.conversation.addComment(comment)
# Comment brain
comment = self.portal.doc1.restrictedTraverse(
'++conversation++default/%s' % cid)
brains = self.catalog.searchResults(
path = {'query' :
'/'.join(comment.getPhysicalPath()) })
comment_brain = brains[0]
self.assertEquals(comment_brain.Title, "Anonymous on Document 1")
def test_type(self):
self.assertEquals(self.comment_brain.portal_type, 'Discussion Item')
+7 -1
View File
@@ -65,7 +65,13 @@ class CommentTest(PloneTestCase):
comment1.creator = "Jim Fulton"
conversation.addComment(comment1)
self.assertEquals("Jim Fulton on Document 1", comment1.Title())
def test_no_name_title(self):
conversation = IConversation(self.portal.doc1)
comment1 = createObject('plone.Comment')
conversation.addComment(comment1)
self.assertEquals("Anonymous on Document 1", comment1.Title())
def test_creator(self):
comment1 = createObject('plone.Comment')
comment1.creator = "Jim"