make sure comments don't get indexed with their parents' UID in Plone 3. only declare dependency on plone.app.uuid in Python 2.6, since we only use it in Plone 4 currently.
svn path=/plone.app.discussion/trunk/; revision=46353
This commit is contained in:
@@ -71,27 +71,36 @@ class CommentTest(PloneTestCase):
|
||||
conversation.addComment(comment1)
|
||||
comment_brain = self.catalog.searchResults(
|
||||
portal_type = 'Discussion Item')[0]
|
||||
self.failUnless(comment_brain.UID)
|
||||
|
||||
# comment should only have a UID if plone.uuid is present
|
||||
try:
|
||||
from plone.uuid.interfaces import IUUID
|
||||
IUUID # pyflakes
|
||||
except ImportError:
|
||||
self.failIf(comment_brain.UID)
|
||||
else:
|
||||
self.failUnless(comment_brain.UID)
|
||||
|
||||
def test_uid_is_unique(self):
|
||||
conversation = IConversation(self.portal.doc1)
|
||||
conversation = IConversation(self.portal.doc1)
|
||||
comment1 = createObject('plone.Comment')
|
||||
conversation.addComment(comment1)
|
||||
comment2 = createObject('plone.Comment')
|
||||
conversation.addComment(comment2)
|
||||
brains = self.catalog.searchResults(
|
||||
portal_type = 'Discussion Item')
|
||||
self.assertNotEquals(brains[0].UID, None)
|
||||
self.assertNotEquals(brains[1].UID, None)
|
||||
self.assertNotEquals(brains[0].UID, brains[1].UID)
|
||||
|
||||
# make sure uids are either both None (i.e. without plone.uuid),
|
||||
# or not equal
|
||||
if brains[0].UID != None or brains[1].UID != None:
|
||||
self.assertNotEquals(brains[0].UID, brains[1].UID)
|
||||
|
||||
def test_comment_uid_differs_from_content_uid(self):
|
||||
conversation = IConversation(self.portal.doc1)
|
||||
conversation = IConversation(self.portal.doc1)
|
||||
comment1 = createObject('plone.Comment')
|
||||
conversation.addComment(comment1)
|
||||
comment_brain = self.catalog.searchResults(
|
||||
portal_type = 'Discussion Item')[0]
|
||||
self.assertNotEquals(comment_brain.UID, None)
|
||||
self.assertNotEquals(self.document_brain.UID, comment_brain.UID)
|
||||
|
||||
def test_title(self):
|
||||
|
||||
Reference in New Issue
Block a user