Did I find the right examples for you? yes no

All Samples(20)  |  Call(20)  |  Derive(0)  |  Import(0)

src/p/r/Products.ImageRepository-1.0.2/Products/ImageRepository/tests/testImageRepository.py   Products.ImageRepository(Download)
            self.failUnless(image['id'] in ids)
            obj = getattr(self.repository, image['id'])
            self.assertEqual(obj.Subject(), image['keywords'])
 
    def testGetUniqueKeywordsFromResults(self):
        results = self.portal.portal_catalog(portal_type='Image')
        repository = self.repository.restrictedTraverse('@@image_repository_view')
        uniquekeywords = repository.getUniqueKeywordsFromResults(results)
        keywords = (('color',3), ('primary',2), ('serious',2), ('nice',1))
        self.assertEqual(len(keywords),len(uniquekeywords))
        for keyword in keywords:
            self.failUnless(uniquekeywords.has_key(keyword[0]))
            self.assertEqual(uniquekeywords[keyword[0]], keyword[1])
 
    def testQueryImageRepository(self):
        REQUEST = {'keywords':['nice']}
        repository = self.repository.restrictedTraverse('@@image_repository_view')
        results = repository.queryImageRepository(REQUEST=REQUEST)
        self.assertEqual(len(results), 1)
        self.assertEqual(results[0].getId, 'green')