[CMF-checkins]
SVN: CMF/branches/tseaver-catalog_events/CMFUid/tests/test_uidannotation.py
- fixed test using events (calling manage_afterAdd /
manage_afterClone directly no longer recurses into subobjects)
Yvo Schubbe
y.2006_ at wcm-solutions.de
Sun May 7 11:26:30 EDT 2006
Log message for revision 68007:
- fixed test using events (calling manage_afterAdd / manage_afterClone directly no longer recurses into subobjects)
Changed:
U CMF/branches/tseaver-catalog_events/CMFUid/tests/test_uidannotation.py
-=-
Modified: CMF/branches/tseaver-catalog_events/CMFUid/tests/test_uidannotation.py
===================================================================
--- CMF/branches/tseaver-catalog_events/CMFUid/tests/test_uidannotation.py 2006-05-07 14:51:52 UTC (rev 68006)
+++ CMF/branches/tseaver-catalog_events/CMFUid/tests/test_uidannotation.py 2006-05-07 15:26:29 UTC (rev 68007)
@@ -18,15 +18,20 @@
import unittest
import Testing
+from OFS.event import ObjectClonedEvent
+from zope.app.container.contained import ObjectAddedEvent
+from zope.event import notify
+
from Products.CMFCore.PortalFolder import PortalFolder
from Products.CMFCore.tests.base.dummy import DummyContent
+from Products.CMFCore.tests.base.testcase import ContentEventAwareTests
from Products.CMFCore.tests.base.testcase import SecurityTest
UID_ATTRNAME = 'cmf_uid'
-class UniqueIdAnnotationToolTests(SecurityTest):
+class UniqueIdAnnotationToolTests(ContentEventAwareTests, SecurityTest):
def _getTargetClass(self):
from Products.CMFUid.UniqueIdAnnotationTool \
@@ -35,10 +40,16 @@
return UniqueIdAnnotationTool
def setUp(self):
+ ContentEventAwareTests.setUp(self)
SecurityTest.setUp(self)
+ self._registerObjectEventHandler()
self.root._setObject('portal_uidannotation', self._getTargetClass()())
self.root._setObject('dummy', DummyContent(id='dummy'))
+ def tearDown(self):
+ SecurityTest.tearDown(self)
+ ContentEventAwareTests.tearDown(self)
+
def test_z3interfaces(self):
from zope.interface.verify import verifyClass
from Products.CMFUid.interfaces import IUniqueIdAnnotation
@@ -129,8 +140,8 @@
annotation = self.root.portal_uidannotation(baz, UID_ATTRNAME)
self.assertEqual( getattr(baz, UID_ATTRNAME), annotation )
- foo.manage_afterAdd(foo, None)
- foo.manage_afterClone(foo)
+ notify(ObjectAddedEvent(foo, foo))
+ notify(ObjectClonedEvent(foo))
self.assertRaises(AttributeError, getattr, baz, UID_ATTRNAME)
More information about the CMF-checkins
mailing list