Reindex comments when they are modified

This commit is contained in:
Gil Forcada
2016-04-07 18:30:30 +02:00
parent 608287692c
commit 26a21a12d5
5 changed files with 22 additions and 2 deletions
@@ -9,6 +9,8 @@ from plone.app.testing import TEST_USER_ID
from Products.CMFCore.utils import getToolByName
from zope.annotation.interfaces import IAnnotations
from zope.component import createObject
from zope.event import notify
from zope.lifecycleevent import ObjectModifiedEvent
import transaction
import unittest2 as unittest
@@ -329,6 +331,13 @@ class CommentCatalogTest(unittest.TestCase):
))
self.assertEqual(len(brains), 0)
def test_reindex_comment(self):
# Make sure a comment is reindexed on the catalog when is modified
self.comment.text = 'Another text'
notify(ObjectModifiedEvent(self.comment))
brains = self.catalog.searchResults(SearchableText='Another text')
self.assertEqual(len(brains), 1)
def test_remove_comments_when_content_object_is_removed(self):
"""Make sure all comments are removed from the catalog, if the content
object is removed.