Commit 85691f65 authored by Hanno Schlichting's avatar Hanno Schlichting

Reorder zcatalog tests and note methods without test coverage

parent b8b99bcc
......@@ -155,56 +155,11 @@ class TestZCatalog(ZCatalogBase, unittest.TestCase):
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 testGetIndexDataForUID(self):
testNum = str(self.upper - 3)
data = self._catalog.getIndexDataForUID(testNum)
self.assertEqual(data['title'][0], testNum)
def test_len(self):
self.assertEquals(len(self._catalog), self.upper)
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))
# manage_edit
# manage_subbingToggle
def testBooleanEvalOn_manage_catalogObject(self):
self.d['11'] = dummyLenFail(11, self.fail)
......@@ -217,6 +172,9 @@ class TestZCatalog(ZCatalogBase, unittest.TestCase):
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 @@ class TestZCatalog(ZCatalogBase, unittest.TestCase):
# 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,6 +244,61 @@ class TestZCatalog(ZCatalogBase, unittest.TestCase):
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):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment