Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes
CMFCore.tests.test_CMFCatalogAware.CMFCatalogAwareTests Class Reference
Inheritance diagram for CMFCore.tests.test_CMFCatalogAware.CMFCatalogAwareTests:
Inheritance graph
[legend]
Collaboration diagram for CMFCore.tests.test_CMFCatalogAware.CMFCatalogAwareTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def tearDown
def test_indexObject
def test_unindexObject
def test_reindexObject
def test_reindexObject_idxs
def test_reindexObjectSecurity
def test_reindexObjectSecurity_missing_raise
def test_reindexObjectSecurity_missing_noraise
def test_catalog_tool
def test_workflow_tool

Public Attributes

 root
 site

Static Public Attributes

 layer = TraversingZCMLLayer

Detailed Description

Definition at line 118 of file test_CMFCatalogAware.py.


Member Function Documentation

Definition at line 122 of file test_CMFCatalogAware.py.

00122 
00123     def setUp(self):
00124         self.root = DummyRoot('')
00125         self.root.site = SimpleFolder('site')
00126         self.site = self.root.site
00127         self.site._setObject('portal_catalog', DummyCatalog())
00128         self.site._setObject('portal_workflow', DummyWorkflowTool())
00129         self.site.foo = TheClass('foo')

Definition at line 130 of file test_CMFCatalogAware.py.

00130 
00131     def tearDown(self):
00132         self._ignore_log_errors()
00133         self._ignore_log_errors(subsystem='CMFCore.CMFCatalogAware')

Here is the call graph for this function:

Definition at line 209 of file test_CMFCatalogAware.py.

00209 
00210     def test_catalog_tool(self):
00211         foo = self.site.foo
00212         self.assertEqual(foo._getCatalogTool(), self.site.portal_catalog)

Definition at line 134 of file test_CMFCatalogAware.py.

00134 
00135     def test_indexObject(self):
00136         foo = self.site.foo
00137         cat = self.site.portal_catalog
00138         foo.indexObject()
00139         self.assertEquals(cat.log, ["index /site/foo"])

Definition at line 146 of file test_CMFCatalogAware.py.

00146 
00147     def test_reindexObject(self):
00148         foo = self.site.foo
00149         cat = self.site.portal_catalog
00150         foo.reindexObject()
00151         self.assertEquals(cat.log, ["reindex /site/foo []"])
00152         self.assert_(foo.notified)

Definition at line 153 of file test_CMFCatalogAware.py.

00153 
00154     def test_reindexObject_idxs(self):
00155         foo = self.site.foo
00156         cat = self.site.portal_catalog
00157         foo.reindexObject(idxs=['bar'])
00158         self.assertEquals(cat.log, ["reindex /site/foo ['bar']"])
00159         self.failIf(foo.notified)

Definition at line 160 of file test_CMFCatalogAware.py.

00160 
00161     def test_reindexObjectSecurity(self):
00162         foo = self.site.foo
00163         self.site.foo.bar = TheClass('bar')
00164         bar = self.site.foo.bar
00165         self.site.foo.hop = TheClass('hop')
00166         hop = self.site.foo.hop
00167         cat = self.site.portal_catalog
00168         cat.setObs([foo, bar, hop])
00169         foo.reindexObjectSecurity()
00170         l = list(cat.log)
00171         l.sort()
00172         self.assertEquals(l, [
00173             "reindex /site/foo %s"%str(CMF_SECURITY_INDEXES),
00174             "reindex /site/foo/bar %s"%str(CMF_SECURITY_INDEXES),
00175             "reindex /site/foo/hop %s"%str(CMF_SECURITY_INDEXES),
00176             ])
00177         self.failIf(foo.notified)
00178         self.failIf(bar.notified)
00179         self.failIf(hop.notified)

Definition at line 194 of file test_CMFCatalogAware.py.

00194 
00195     def test_reindexObjectSecurity_missing_noraise(self):
00196         # Raising disabled
00197         self._catch_log_errors(subsystem='CMFCore.CMFCatalogAware')
00198         foo = self.site.foo
00199         missing = TheClass('missing').__of__(foo)
00200         missing.GETOBJECT_RAISES = False
00201         cat = self.site.portal_catalog
00202         cat.setObs([foo, missing])
00203         foo.reindexObjectSecurity()
00204         self.assertEquals(cat.log,
00205                           ["reindex /site/foo %s"%str(CMF_SECURITY_INDEXES)])
00206         self.failIf(foo.notified)
00207         self.failIf(missing.notified)
00208         self.assertEqual( len(self.logged), 1 ) # logging because no raise

Here is the call graph for this function:

Definition at line 180 of file test_CMFCatalogAware.py.

00180 
00181     def test_reindexObjectSecurity_missing_raise(self):
00182         # Exception raised for missing object (Zope 2.8 brains)
00183         foo = self.site.foo
00184         missing = TheClass('missing').__of__(foo)
00185         missing.GETOBJECT_RAISES = True
00186         cat = self.site.portal_catalog
00187         try:
00188             self._catch_log_errors()
00189             cat.setObs([foo, missing])
00190         finally:
00191             self._ignore_log_errors()
00192         self.assertRaises(NotFound, foo.reindexObjectSecurity)
00193         self.failIf( self.logged ) # no logging due to raise

Here is the call graph for this function:

Definition at line 140 of file test_CMFCatalogAware.py.

00140 
00141     def test_unindexObject(self):
00142         foo = self.site.foo
00143         cat = self.site.portal_catalog
00144         foo.unindexObject()
00145         self.assertEquals(cat.log, ["unindex /site/foo"])

Definition at line 213 of file test_CMFCatalogAware.py.

00213 
00214     def test_workflow_tool(self):
00215         foo = self.site.foo
00216         self.assertEqual(foo._getWorkflowTool(), self.site.portal_workflow)


Member Data Documentation

Definition at line 120 of file test_CMFCatalogAware.py.

Definition at line 123 of file test_CMFCatalogAware.py.

Definition at line 125 of file test_CMFCatalogAware.py.


The documentation for this class was generated from the following file: