collection test added.

svn path=/plone.app.discussion/trunk/; revision=35126
This commit is contained in:
Timo Stollenwerk 2010-03-17 15:00:19 +00:00
parent e00453e9d6
commit b70774343f

View File

@ -313,16 +313,14 @@ class CommentCatalogTest(PloneTestCase):
def test_collection(self): def test_collection(self):
self.typetool.constructContent('Topic', self.portal, 'topic') self.typetool.constructContent('Topic', self.portal, 'topic')
topic = self.portal.topic topic = self.portal.topic
topic.addCriterion('type_crit', 'ATPortalTypeCriterion') crit = topic.addCriterion('Type', 'ATSimpleStringCriterion')
self.failUnless('crit__type_crit_ATPortalTypeCriterion' in topic) crit.setValue('Discussion Item')
topic.getCriterion('type_crit_ATPortalTypeCriterion').setValue('Comment')
query = topic.buildQuery() query = topic.buildQuery()
self.assertEquals(len(query), 1)
self.assertEquals(query['type_crit'], ('Comment',))
# XXX: FAIL # Make sure the comment we just added is returned by the collection
#self.assertEquals(len(topic.queryCatalog()), 1) self.assertEquals(len(query), 1)
self.assertEquals(query['Type'], 'Discussion Item')
self.assertEquals(len(topic.queryCatalog()), 1)
def test_suite(): def test_suite():
return unittest.defaultTestLoader.loadTestsFromName(__name__) return unittest.defaultTestLoader.loadTestsFromName(__name__)