Changeset 3556 in products for quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/tests/test_portlet.py
- Timestamp:
- Sep 14, 2012 10:16:29 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/tests/test_portlet.py
r3555 r3556 195 195 196 196 def testRandomQuery(self): 197 # we're being perhaps a bit too clever in random mode with the internals of the198 # LazyMap returned by the collection query, so let's try a bunch of scenarios199 # t o make sure they work197 # we're being perhaps a bit too clever in random mode with the 198 # internals of the LazyMap returned by the collection query, so let's 199 # try a bunch of scenarios to make sure they work 200 200 201 201 def reset_memoize(inst): 202 # Decorator memoize adds attribute 202 # Decorator memoize adds attribute('_memojito_') to class instance. 203 203 # It has cached function and their values so it should be deleted 204 204 # for testing. … … 222 222 getattr(self.folder, 'folder_%s' % i).reindexObject() 223 223 224 # collection with no criteria -- should return empty list, without error 224 # collection with no criteria -- should return empty list, without 225 # error 225 226 self.assertEqual(len(collectionrenderer.results()), 0) 226 227 reset_memoize(collectionrenderer) … … 253 254 collectionrenderer.results() 254 255 255 # collection with sorting -- should behave similarly (sort is ignored internally) 256 # collection with sorting -- should behave similarly (sort is 257 # ignored internally) 256 258 self.folder.collection.setSortCriterion('modified', False) 257 259 self.assertEqual(len(collectionrenderer.results()), 1) 258 260 reset_memoize(collectionrenderer) 259 261 260 # same criteria, now with limit set to 2 -- should return 2 (random) folders 262 # same criteria, now with limit set to 2 -- should return 2 (random) 263 # folders 261 264 collectionrenderer.data.limit = 2 262 265 self.assertEqual(len(collectionrenderer.results()), 2) 263 266 reset_memoize(collectionrenderer) 264 267 265 # make sure there's no error if the limit is greater than the # of results found 268 # make sure there's no error if the limit is greater than the # of 269 # results found 266 270 collectionrenderer.data.limit = 10 267 271 self.failUnless(len(collectionrenderer.results()) >= 6)
Note: See TracChangeset
for help on using the changeset viewer.