[Zope-Checkins] SVN: Zope/trunk/src/Products/ZCatalog/tests/test_zcatalog.py Reorder zcatalog tests and note methods without test coverage
Hanno Schlichting
hannosch at hannosch.eu
Sun Aug 1 10:01:03 EDT 2010
Log message for revision 115331:
Reorder zcatalog tests and note methods without test coverage
Changed:
U Zope/trunk/src/Products/ZCatalog/tests/test_zcatalog.py
-=-
Modified: Zope/trunk/src/Products/ZCatalog/tests/test_zcatalog.py
===================================================================
--- Zope/trunk/src/Products/ZCatalog/tests/test_zcatalog.py 2010-08-01 13:39:28 UTC (rev 115330)
+++ Zope/trunk/src/Products/ZCatalog/tests/test_zcatalog.py 2010-08-01 14:01:02 UTC (rev 115331)
@@ -155,57 +155,12 @@
verifyClass(IZCatalog, ZCatalog)
- def testGetMetadataForUID(self):
- testNum = str(self.upper - 3) # as good as any..
- data = self._catalog.getMetadataForUID(testNum)
- self.assertEqual(data['title'], testNum)
+ def test_len(self):
+ self.assertEquals(len(self._catalog), self.upper)
- def testGetIndexDataForUID(self):
- testNum = str(self.upper - 3)
- data = self._catalog.getIndexDataForUID(testNum)
- self.assertEqual(data['title'][0], testNum)
+ # manage_edit
+ # manage_subbingToggle
- def testSearch(self):
- query = {'title': ['5', '6', '7']}
- sr = self._catalog.searchResults(query)
- self.assertEqual(len(sr), 3)
- sr = self._catalog.search(query)
- self.assertEqual(len(sr), 3)
-
- def testUpdateMetadata(self):
- self._catalog.catalog_object(zdummy(1), '1')
- data = self._catalog.getMetadataForUID('1')
- self.assertEqual(data['title'], '1')
- self._catalog.catalog_object(zdummy(2), '1', update_metadata=0)
- data = self._catalog.getMetadataForUID('1')
- self.assertEqual(data['title'], '1')
- self._catalog.catalog_object(zdummy(2), '1', update_metadata=1)
- data = self._catalog.getMetadataForUID('1')
- self.assertEqual(data['title'], '2')
- # update_metadata defaults to true, test that here
- self._catalog.catalog_object(zdummy(1), '1')
- data = self._catalog.getMetadataForUID('1')
- self.assertEqual(data['title'], '1')
-
- def testReindexIndexDoesntDoMetadata(self):
- self.d['0'].num = 9999
- self._catalog.reindexIndex('title', {})
- data = self._catalog.getMetadataForUID('0')
- self.assertEqual(data['title'], '0')
-
- def testReindexIndexesFalse(self):
- # setup
- false_id = self.upper + 1
- ob = zdummyFalse(false_id)
- self.d[str(false_id)] = ob
- self._catalog.catalog_object(ob, str(false_id))
- # test, object evaluates to false; there was bug which caused the
- # object to be removed from index
- ob.num = 9999
- self._catalog.reindexIndex('title', {})
- result = self._catalog(title='9999')
- self.assertEquals(1, len(result))
-
def testBooleanEvalOn_manage_catalogObject(self):
self.d['11'] = dummyLenFail(11, self.fail)
self.d['12'] = dummyNonzeroFail(12, self.fail)
@@ -217,6 +172,9 @@
self._catalog.manage_catalogObject(None, myresponse(),
'URL1', urls=('11', '12'))
+ # manage_uncatalogObject
+ # manage_catalogReindex
+
def testBooleanEvalOn_refreshCatalog_getobject(self):
# wrap catalog under the fake parent providing unrestrictedTraverse()
catalog = self._catalog.__of__(fakeparent(self.d))
@@ -231,6 +189,40 @@
# neither should these
catalog.getobject(rid)
+ # manage_catalogClear
+ # manage_catalogFoundItems
+ # manage_addColumn
+ # manage_delColumn
+ # manage_addIndex
+ # manage_delIndex
+ # manage_clearIndex
+
+ def testReindexIndexDoesntDoMetadata(self):
+ self.d['0'].num = 9999
+ self._catalog.reindexIndex('title', {})
+ data = self._catalog.getMetadataForUID('0')
+ self.assertEqual(data['title'], '0')
+
+ def testReindexIndexesFalse(self):
+ # setup
+ false_id = self.upper + 1
+ ob = zdummyFalse(false_id)
+ self.d[str(false_id)] = ob
+ self._catalog.catalog_object(ob, str(false_id))
+ # test, object evaluates to false; there was bug which caused the
+ # object to be removed from index
+ ob.num = 9999
+ self._catalog.reindexIndex('title', {})
+ result = self._catalog(title='9999')
+ self.assertEquals(1, len(result))
+
+ # manage_reindexIndex
+ # catalog_object
+ # uncatalog_object
+ # uniqueValuesFor
+ # getpath
+ # getrid
+
def test_getobject_traversal(self):
# getobject doesn't mask TraversalErrors and doesn't delegate to
# resolve_url
@@ -252,7 +244,62 @@
self.d['0'] = None
self.assertEquals(catalog.getobject(rid0), None)
+ def testGetMetadataForUID(self):
+ testNum = str(self.upper - 3) # as good as any..
+ data = self._catalog.getMetadataForUID(testNum)
+ self.assertEqual(data['title'], testNum)
+ def testGetIndexDataForUID(self):
+ testNum = str(self.upper - 3)
+ data = self._catalog.getIndexDataForUID(testNum)
+ self.assertEqual(data['title'][0], testNum)
+
+ def testUpdateMetadata(self):
+ self._catalog.catalog_object(zdummy(1), '1')
+ data = self._catalog.getMetadataForUID('1')
+ self.assertEqual(data['title'], '1')
+ self._catalog.catalog_object(zdummy(2), '1', update_metadata=0)
+ data = self._catalog.getMetadataForUID('1')
+ self.assertEqual(data['title'], '1')
+ self._catalog.catalog_object(zdummy(2), '1', update_metadata=1)
+ data = self._catalog.getMetadataForUID('1')
+ self.assertEqual(data['title'], '2')
+ # update_metadata defaults to true, test that here
+ self._catalog.catalog_object(zdummy(1), '1')
+ data = self._catalog.getMetadataForUID('1')
+ self.assertEqual(data['title'], '1')
+
+ # getMetadataForRID
+ # getIndexDataForRID
+ # schema
+ # indexes
+ # index_objects
+ # getIndexObjects
+ # _searchable_arguments
+ # _searchable_result_columns
+
+ def testSearchResults(self):
+ query = {'title': ['5', '6', '7']}
+ sr = self._catalog.searchResults(query)
+ self.assertEqual(len(sr), 3)
+
+ def testCall(self):
+ query = {'title': ['5', '6', '7']}
+ sr = self._catalog(query)
+ self.assertEqual(len(sr), 3)
+
+ def testSearch(self):
+ query = {'title': ['5', '6', '7']}
+ sr = self._catalog.search(query)
+ self.assertEqual(len(sr), 3)
+
+ # resolve_url
+ # resolve_path
+ # manage_normalize_paths
+ # manage_setProgress
+ # _getProgressThreshold
+
+
class TestAddDelColumnIndex(ZCatalogBase, unittest.TestCase):
def testAddIndex(self):
More information about the Zope-Checkins
mailing list