[CMF-checkins] CVS: CMF/CMFUid/tests - test_uidgeneration.py:1.4

Grégoire Weber zope.org at incept.ch
Thu Jul 22 09:43:38 EDT 2004


Update of /cvs-repository/CMF/CMFUid/tests
In directory cvs.zope.org:/tmp/cvs-serv14333/tests

Modified Files:
	test_uidgeneration.py 
Log Message:
- moved all annotation related tests to test_uidannotation.p


=== CMF/CMFUid/tests/test_uidgeneration.py 1.3 => 1.4 ===
--- CMF/CMFUid/tests/test_uidgeneration.py:1.3	Tue Jul 20 21:37:02 2004
+++ CMF/CMFUid/tests/test_uidgeneration.py	Thu Jul 22 09:43:37 2004
@@ -25,98 +25,26 @@
 
 from Products.CMFCore.tests.base.testcase import SecurityTest
 
-from Products.CMFUid.interfaces \
-    import IUniqueIdGenerator, IAnnotatedUniqueId
+from Products.CMFUid.interfaces import IUniqueIdGenerator
 from Products.CMFUid.UniqueIdGeneratorTool import UniqueIdGeneratorTool
 
 
-UID_ATTRNAME = 'cmf_uid'
-
 class UniqueIdGeneratorTests(SecurityTest):
 
     def setUp(self):
         SecurityTest.setUp(self)
         self.root._setObject('portal_uidgenerator', UniqueIdGeneratorTool())
-        self.root._setObject('dummy', DummyContent(id='dummy'))
     
-    def attachUniqueId(self):
-        # attach a unique id to dummy content
-        dummy = self.root.dummy
-        generator = self.root.portal_uidgenerator
-        setattr(dummy, UID_ATTRNAME, generator())
-        uid = getattr(dummy, UID_ATTRNAME)
-        uid.setId(UID_ATTRNAME)
-        return dummy, uid
-        
     def test_interface(self):
         generator = self.root.portal_uidgenerator
         IUniqueIdGenerator.isImplementedBy(generator)
-        IAnnotatedUniqueId.isImplementedBy(generator())
         
-    def test_returnedUidsAreDifferent(self):
+    def test_returnedUidsAreValidAndDifferent(self):
         generator = self.root.portal_uidgenerator
         uid1 = generator()
         uid2 = generator()
         self.failIfEqual(uid1, uid2)
-        self.failIfEqual(uid1(), uid2())
-        self.failIfEqual(uid1(), None)
-        
-    def test_getIdOfUidObject(self):
-        generator = self.root.portal_uidgenerator
-        uid1 = generator()
-        uid1.setId('blah')
-        self.assertEqual(uid1.getId(), 'blah')
-        
-    # copy/rename/add events: Just to remember
-    #
-    # add/import obj:
-    #   obj.manage_afterAdd(obj, obj, folder)
-    #
-    # move/rename obj:
-    #   obj.manage_beforeDelete(obj, obj, source_folder)
-    #   obj.manage_afterAdd(obj_at_target, obj_at_target, target_folder)
-    #
-    # copy and paste (clone) obj:
-    #   obj.manage_afterAdd(obj_at_target, obj_at_target, target_folder)
-    #   obj.manage_afterClone(obj_at_target, obj_at_target)
-        
-    def test_simulateItemAddRemovingUid(self):
-        item, uid = self.attachUniqueId()
-        uid.manage_afterAdd(item, None)
-        self.assertRaises(AttributeError, getattr, item, UID_ATTRNAME)
-        
-    def test_simulateItemAddDoesNotTouchUid(self):
-        item, uid = self.attachUniqueId()
-        self.root.portal_uidgenerator.remove_on_add = False
-        uid.manage_afterAdd(item, None)
-        self.assertEqual(getattr(item, UID_ATTRNAME)(), 1)
-        
-    def test_simulateItemRename(self):
-        item, uid = self.attachUniqueId()
-        uid.manage_beforeDelete(item, None)
-        uid.manage_afterAdd(item, None)
-        self.assertEqual(getattr(item, UID_ATTRNAME)(), 1)
-        
-    def test_simulateItemCloneRemovingUid1(self):
-        item, uid = self.attachUniqueId()
-        uid.manage_afterAdd(item, None)
-        uid.manage_afterClone(item)
-        self.assertRaises(AttributeError, getattr, item, UID_ATTRNAME)
-        
-    def test_simulateItemCloneRemovingUid2(self):
-        item, uid = self.attachUniqueId()
-        self.root.portal_uidgenerator.remove_on_add = False
-        uid.manage_afterAdd(item, None)
-        uid.manage_afterClone(item)
-        self.assertRaises(AttributeError, getattr, item, UID_ATTRNAME)
-        
-    def test_simulateItemCloneDoesNotTouchUid(self):
-        item, uid = self.attachUniqueId()
-        self.root.portal_uidgenerator.remove_on_clone = False
-        uid.manage_afterAdd(item, None)
-        uid.manage_afterClone(item)
-        self.assertEqual(getattr(item, UID_ATTRNAME)(), 1)
-
+        self.failIfEqual(uid1, None)
 
 def test_suite():
     return TestSuite((



More information about the CMF-checkins mailing list