[CMF-checkins] CVS: Products/CMFDefault/tests -
test_Image.py:1.4.40.3
Stefan H. Holek
stefan at epy.co.at
Sat Aug 7 15:24:10 EDT 2004
Update of /cvs-repository/Products/CMFDefault/tests
In directory cvs.zope.org:/tmp/cvs-serv26693/CMFDefault/tests
Modified Files:
Tag: CMF-1_4-branch
test_Image.py
Log Message:
- Added test for http://www.zope.org/Collectors/CMF/176
- Applied same fix to File.
=== Products/CMFDefault/tests/test_Image.py 1.4.40.2 => 1.4.40.3 ===
--- Products/CMFDefault/tests/test_Image.py:1.4.40.2 Tue Jul 27 17:35:15 2004
+++ Products/CMFDefault/tests/test_Image.py Sat Aug 7 15:24:09 2004
@@ -6,6 +6,10 @@
from Products.CMFDefault.File import File
from Products.CMFDefault.Image import Image
from Products.CMFDefault import tests
+from Products.CMFCore.tests.base.testcase import RequestTest
+from AccessControl.SecurityManagement import newSecurityManager
+from AccessControl.SecurityManagement import noSecurityManager
+from AccessControl.User import UnrestrictedUser
TESTS_HOME = tests.__path__[0]
TEST_JPG = os.path.join(TESTS_HOME, 'TestImage.jpg')
@@ -49,9 +53,90 @@
self.assertEqual(image.content_type, 'image/gif')
+class TestImageCopyPaste(RequestTest):
+
+ # Tests related to http://www.zope.org/Collectors/CMF/176
+ # Copy/pasting an image (or file) should reset the object's workflow state.
+
+ def setUp(self):
+ RequestTest.setUp(self)
+ try:
+ newSecurityManager(None, UnrestrictedUser('manager', '', ['Manager'], []))
+ self.root.manage_addProduct['CMFDefault'].manage_addCMFSite('cmf')
+ self.site = self.root.cmf
+ self.site.invokeFactory('File', id='file')
+ self.site.portal_workflow.doActionFor(self.site.file, 'publish')
+ self.site.invokeFactory('Image', id='image')
+ self.site.portal_workflow.doActionFor(self.site.image, 'publish')
+ self.site.invokeFactory('Folder', id='subfolder')
+ self.subfolder = self.site.subfolder
+ self.workflow = self.site.portal_workflow
+ get_transaction().commit(1) # Make sure we have _p_jars
+ except:
+ self.tearDown()
+ raise
+
+ def tearDown(self):
+ noSecurityManager()
+ RequestTest.tearDown(self)
+
+ def test_File_CopyPasteResetsWorkflowState(self):
+ # Copy/pasting a File should reset wf state to private
+ cb = self.site.manage_copyObjects(['file'])
+ self.subfolder.manage_pasteObjects(cb)
+ review_state = self.workflow.getInfoFor(self.subfolder.file, 'review_state')
+ self.assertEqual(review_state, 'private')
+
+ def test_File_CloneResetsWorkflowState(self):
+ # Cloning a File should reset wf state to private
+ self.subfolder.manage_clone(self.site.file, 'file')
+ review_state = self.workflow.getInfoFor(self.subfolder.file, 'review_state')
+ self.assertEqual(review_state, 'private')
+
+ def test_File_CutPasteKeepsWorkflowState(self):
+ # Cut/pasting a File should keep the wf state
+ cb = self.site.manage_cutObjects(['file'])
+ self.subfolder.manage_pasteObjects(cb)
+ review_state = self.workflow.getInfoFor(self.subfolder.file, 'review_state')
+ self.assertEqual(review_state, 'published')
+
+ def test_File_RenameKeepsWorkflowState(self):
+ # Renaming a File should keep the wf state
+ self.site.manage_renameObjects(['file'], ['file2'])
+ review_state = self.workflow.getInfoFor(self.site.file2, 'review_state')
+ self.assertEqual(review_state, 'published')
+
+ def test_Image_CopyPasteResetsWorkflowState(self):
+ # Copy/pasting an Image should reset wf state to private
+ cb = self.site.manage_copyObjects(['image'])
+ self.subfolder.manage_pasteObjects(cb)
+ review_state = self.workflow.getInfoFor(self.subfolder.image, 'review_state')
+ self.assertEqual(review_state, 'private')
+
+ def test_Image_CloneResetsWorkflowState(self):
+ # Cloning an Image should reset wf state to private
+ self.subfolder.manage_clone(self.site.image, 'image')
+ review_state = self.workflow.getInfoFor(self.subfolder.image, 'review_state')
+ self.assertEqual(review_state, 'private')
+
+ def test_Image_CutPasteKeepsWorkflowState(self):
+ # Cut/pasting an Image should keep the wf state
+ cb = self.site.manage_cutObjects(['image'])
+ self.subfolder.manage_pasteObjects(cb)
+ review_state = self.workflow.getInfoFor(self.subfolder.image, 'review_state')
+ self.assertEqual(review_state, 'published')
+
+ def test_Image_RenameKeepsWorkflowState(self):
+ # Renaming an Image should keep the wf state
+ self.site.manage_renameObjects(['image'], ['image2'])
+ review_state = self.workflow.getInfoFor(self.site.image2, 'review_state')
+ self.assertEqual(review_state, 'published')
+
+
def test_suite():
return TestSuite((
makeSuite(TestImageElement),
+ makeSuite(TestImageCopyPaste),
))
return suite
More information about the CMF-checkins
mailing list