Back to index

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

List of all members.

Public Member Functions

def setUp
def test_nonCallableItem
def test_callableItemWithMarkerOnly
def test_callableItemWithHooksOnly
def test_callableItemWithMarkerAndHooks
def test_talkbackItem

Public Attributes

 test
 folder
 sub

Static Public Attributes

 layer = TraversingEventZCMLLayer

Detailed Description

Definition at line 146 of file test_OpaqueItems.py.


Member Function Documentation

Definition at line 150 of file test_OpaqueItems.py.

00150 
00151     def setUp(self):
00152         SecurityTest.setUp(self)
00153 
00154         root = self.root
00155 
00156         # setting up types tool
00157         root._setObject( 'portal_types', TypesTool() )
00158 
00159         # setup portal
00160         try:
00161             root._delObject('test')
00162         except AttributeError:
00163             pass
00164         root._setObject('test', PortalFolder('test', ''))
00165         self.test = test = self.root.test
00166 
00167         # setting up folders
00168         test._setObject( 'folder', PortalFolder( 'folder', '' ) )
00169         folder = self.folder = test.folder
00170         folder._setObject( 'sub', PortalFolder( 'sub', '' ) )
00171         sub = self.sub = folder.sub
00172 
00173         #----- hacks to allow pasting (see also test_PortalFolder)
00174         # WAAA! force sub to allow paste of Dummy object.
00175         sub.all_meta_types = extra_meta_types()
00176 
00177         # delete items if necessary
00178         try:
00179             folder._delObject('dummy')
00180         except AttributeError:
00181             pass
00182         try:
00183             sub._delObject('dummy')
00184         except AttributeError:
00185             pass

Definition at line 221 of file test_OpaqueItems.py.

00221 
00222     def test_callableItemWithHooksOnly(self):
00223         folder = self.folder
00224         sub = self.sub
00225         dummy = addDummyContent(folder, 'dummy', Hooks)
00226 
00227         self.failIf(dummy.isNotifiedByAfterAdd())
00228         self.failIf(dummy.isNotifiedByAfterClone())
00229         self.failIf(dummy.isNotifiedByBeforeDelete())
00230 
00231         # WAAAA! must get _p_jar set
00232         old, dummy._p_jar = sub._p_jar, self.root._p_jar
00233         try:
00234             cp = folder.manage_copyObjects(ids=['dummy'])
00235             sub.manage_pasteObjects(cp)
00236         finally:
00237             dummy._p_jar = old
00238 
00239         self.failIf(dummy.isNotifiedByAfterAdd())
00240         self.failIf(dummy.isNotifiedByAfterClone())
00241         self.failIf(dummy.isNotifiedByBeforeDelete())

Here is the call graph for this function:

Definition at line 242 of file test_OpaqueItems.py.

00242 
00243     def test_callableItemWithMarkerAndHooks(self):
00244         folder = self.folder
00245         sub = self.sub
00246         dummy = addDummyContent(folder, 'dummy', MarkerAndHooks)
00247 
00248         self.assertEqual(dummy.isNotifiedByAfterAdd(), 1)
00249         self.failIf(dummy.isNotifiedByAfterClone())
00250         self.failIf(dummy.isNotifiedByBeforeDelete())
00251 
00252         # WAAAA! must get _p_jar set
00253         old, dummy._p_jar = sub._p_jar, self.root._p_jar
00254         try:
00255             cp = folder.manage_copyObjects(ids=['dummy'])
00256             sub.manage_pasteObjects(cp)
00257         finally:
00258             dummy._p_jar = old
00259 
00260         self.assertEqual(dummy.isNotifiedByAfterAdd(), 2)
00261         self.assertEqual(dummy.isNotifiedByAfterClone(), 1)
00262         self.failIf(dummy.isNotifiedByBeforeDelete())

Here is the call graph for this function:

Definition at line 200 of file test_OpaqueItems.py.

00200 
00201     def test_callableItemWithMarkerOnly(self):
00202         folder = self.folder
00203         sub = self.sub
00204         dummy = addDummyContent(folder, 'dummy', Marker)
00205 
00206         self.failIf(dummy.isNotifiedByAfterAdd())
00207         self.failIf(dummy.isNotifiedByAfterClone())
00208         self.failIf(dummy.isNotifiedByBeforeDelete())
00209 
00210         # WAAAA! must get _p_jar set
00211         old, dummy._p_jar = sub._p_jar, self.root._p_jar
00212         try:
00213             cp = folder.manage_copyObjects(ids=['dummy'])
00214             sub.manage_pasteObjects(cp)
00215         finally:
00216             dummy._p_jar = old
00217 
00218         self.failIf(dummy.isNotifiedByAfterAdd())
00219         self.failIf(dummy.isNotifiedByAfterClone())
00220         self.failIf(dummy.isNotifiedByBeforeDelete())

Here is the call graph for this function:

Definition at line 186 of file test_OpaqueItems.py.

00186 
00187     def test_nonCallableItem(self):
00188         # no exception should be raised
00189         folder = self.folder
00190         sub = self.sub
00191         dummy = addDummyContent(folder, 'dummy', None)
00192 
00193         # WAAAA! must get _p_jar set
00194         old, dummy._p_jar = sub._p_jar, self.root._p_jar
00195         try:
00196             cp = folder.manage_copyObjects(ids=['dummy'])
00197             sub.manage_pasteObjects(cp)
00198         finally:
00199             dummy._p_jar = old

Here is the call graph for this function:

Definition at line 263 of file test_OpaqueItems.py.

00263 
00264     def test_talkbackItem(self):
00265         folder = self.folder
00266         sub = self.sub
00267 
00268         dummy = addDummyContent(folder, 'dummy', 'talkback')
00269 
00270         self.assertEqual(dummy.isNotifiedByAfterAdd(), 1)
00271         self.failIf(dummy.isNotifiedByAfterClone())
00272         self.failIf(dummy.isNotifiedByBeforeDelete())
00273 
00274         # WAAAA! must get _p_jar set
00275         old, dummy._p_jar = sub._p_jar, self.root._p_jar
00276         try:
00277             cp = folder.manage_copyObjects(ids=['dummy'])
00278             sub.manage_pasteObjects(cp)
00279         finally:
00280             dummy._p_jar = old
00281 
00282         self.assertEqual(dummy.isNotifiedByAfterAdd(), 2)
00283         self.assertEqual(dummy.isNotifiedByAfterClone(), 1)
00284         self.failIf(dummy.isNotifiedByBeforeDelete())
00285 

Here is the call graph for this function:


Member Data Documentation

Definition at line 168 of file test_OpaqueItems.py.

Definition at line 148 of file test_OpaqueItems.py.

Definition at line 170 of file test_OpaqueItems.py.

Definition at line 164 of file test_OpaqueItems.py.


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