This commit is contained in:
Timo Stollenwerk 2013-04-17 19:37:10 +02:00
parent 29fe4bbec7
commit 20935da608

View File

@ -13,8 +13,9 @@ from Products.CMFCore.utils import getToolByName
from plone.app.testing import TEST_USER_ID, setRoles from plone.app.testing import TEST_USER_ID, setRoles
from plone.app.discussion.testing import \ from plone.app.discussion.testing import (
PLONE_APP_DISCUSSION_INTEGRATION_TESTING PLONE_APP_DISCUSSION_INTEGRATION_TESTING
)
from plone.app.discussion.interfaces import IConversation from plone.app.discussion.interfaces import IConversation
@ -29,14 +30,22 @@ class CatalogSetupTest(unittest.TestCase):
self.portal = self.layer['portal'] self.portal = self.layer['portal']
def test_catalog_installed(self): def test_catalog_installed(self):
self.assertTrue('total_comments' in self.assertTrue(
self.portal.portal_catalog.indexes()) 'total_comments' in
self.assertTrue('commentators' in self.portal.portal_catalog.indexes()
self.portal.portal_catalog.indexes()) )
self.assertTrue('total_comments' in self.assertTrue(
self.portal.portal_catalog.schema()) 'commentators' in
self.assertTrue('in_response_to' in self.portal.portal_catalog.indexes()
self.portal.portal_catalog.schema()) )
self.assertTrue(
'total_comments' in
self.portal.portal_catalog.schema()
)
self.assertTrue(
'in_response_to' in
self.portal.portal_catalog.schema()
)
def test_collection_criteria_installed(self): def test_collection_criteria_installed(self):
try: try:
@ -54,9 +63,11 @@ class ConversationCatalogTest(unittest.TestCase):
def setUp(self): def setUp(self):
self.portal = self.layer['portal'] self.portal = self.layer['portal']
setRoles(self.portal, TEST_USER_ID, ['Manager']) setRoles(self.portal, TEST_USER_ID, ['Manager'])
self.portal.invokeFactory(id='doc1', self.portal.invokeFactory(
id='doc1',
Title='Document 1', Title='Document 1',
type_name='Document') type_name='Document'
)
self.catalog = getToolByName(self.portal, 'portal_catalog') self.catalog = getToolByName(self.portal, 'portal_catalog')
conversation = IConversation(self.portal.doc1) conversation = IConversation(self.portal.doc1)
@ -72,8 +83,10 @@ class ConversationCatalogTest(unittest.TestCase):
self.comment_id = new_comment1_id self.comment_id = new_comment1_id
brains = self.catalog.searchResults(dict( brains = self.catalog.searchResults(dict(
path={'query': path={
'/'.join(self.portal.doc1.getPhysicalPath())}, 'query':
'/'.join(self.portal.doc1.getPhysicalPath())
},
portal_type="Document" portal_type="Document"
)) ))
self.conversation = conversation self.conversation = conversation
@ -523,8 +536,10 @@ class NoConversationCatalogTest(unittest.TestCase):
self.assertEqual(self.doc1_brain.total_comments, 0) self.assertEqual(self.doc1_brain.total_comments, 0)
# Make sure no conversation has been created # Make sure no conversation has been created
self.assertTrue('plone.app.discussion:conversation' not in self.assertTrue(
IAnnotations(self.portal.doc1)) 'plone.app.discussion:conversation' not in
IAnnotations(self.portal.doc1)
)
def test_suite(): def test_suite():