Back to index

plone3  3.1.7
Public Member Functions
CMFFormController.tests.testCopyRename.TestCopyRename Class Reference

List of all members.

Public Member Functions

def testRename
def testCopy

Detailed Description

Definition at line 19 of file testCopyRename.py.


Member Function Documentation

Definition at line 61 of file testCopyRename.py.

00061 
00062         def testCopy(self):
00063             formcontroller = self.portal.portal_form_controller
00064             self.folder.manage_addProduct['CMFFormController'].manage_addControllerPageTemplate('test', 'Test', '<html>test</html>')
00065 
00066             pt = self.folder.test
00067             pt.actions.set(FormAction(pt.getId(), 'success', None, None, 'traverse_to', 'test3', self.portal.portal_form_controller))
00068             self.assertEqual(len(pt.actions.getFiltered()), 1)
00069             self.assertEqual(pt.actions.match('test', 'success', 'Document', 'submit').getActionArg(), 'test3')
00070 
00071             pt.validators.set(FormValidator(pt.getId(), None, None, 'a,b,c', self.portal.portal_form_controller))
00072             self.assertEqual(len(pt.validators.getFiltered(object_id='test')), 1)
00073             self.assertEqual(pt.validators.match('test', 'Document', 'submit').getValidators(), ['a','b','c'])
00074         
00075             formcontroller.actions.set(FormAction(pt.getId(), 'success', None, None, 'traverse_to', 'test4', self.portal.portal_form_controller))
00076             self.assertEqual(len(pt.actions.getFiltered()), 1)
00077             self.assertEqual(formcontroller.actions.match('test', 'success', 'Document', 'submit').getActionArg(), 'test4')
00078 
00079             formcontroller.validators.set(FormValidator(pt.getId(), None, None, 'd,e,f', self.portal.portal_form_controller))
00080             self.assertEqual(len(formcontroller.validators.getFiltered(object_id='test')), 1)
00081             self.assertEqual(formcontroller.validators.match('test', 'Document', 'submit').getValidators(), ['d','e','f'])
00082 
00083             transaction.savepoint(optimistic=True)
00084 
00085             self.loginAsPortalOwner()
00086             cb = self.folder.manage_copyObjects(['test'])
00087             self.folder.manage_pasteObjects(cb)
00088             pt2 = self.folder.copy_of_test
00089             self.assertEqual(len(pt2.actions.getFiltered(object_id='test')), 0)
00090             self.assertEqual(len(pt2.actions.getFiltered(object_id='copy_of_test')), 1)
00091             self.assertEqual(formcontroller.actions.match('copy_of_test', 'success', 'Document', 'submit').getActionArg(), 'test4')
00092             self.assertEqual(formcontroller.actions.match('test', 'success', 'Document', 'submit').getActionArg(), 'test4')
00093 
00094             self.assertEqual(len(pt2.validators.getFiltered(object_id='test')), 0)
00095             self.assertEqual(len(pt2.validators.getFiltered(object_id='copy_of_test')), 1)
00096             self.assertEqual(formcontroller.validators.match('copy_of_test', 'Document', 'submit').getValidators(), ['d','e','f'])
00097             self.assertEqual(formcontroller.validators.match('test', 'Document', 'submit').getValidators(), ['d','e','f'])
00098 
00099             formcontroller._purge()
00100             self.assertEqual(formcontroller.actions.match('test', 'success', 'Document', 'submit').getActionArg(), 'test4')
00101             self.assertEqual(formcontroller.actions.match('copy_of_test', 'success', 'Document', 'submit').getActionArg(), 'test4')
00102             self.assertEqual(formcontroller.validators.match('copy_of_test', 'Document', 'submit').getValidators(), ['d','e','f'])
00103             self.assertEqual(formcontroller.validators.match('test', 'Document', 'submit').getValidators(), ['d','e','f'])

Here is the call graph for this function:

Definition at line 21 of file testCopyRename.py.

00021 
00022         def testRename(self):
00023             formcontroller = self.portal.portal_form_controller
00024             self.folder.manage_addProduct['CMFFormController'].manage_addControllerPageTemplate('test', 'Test', '<html>test</html>')
00025 
00026             pt = self.folder.test
00027             pt.actions.set(FormAction(pt.getId(), 'success', None, None, 'traverse_to', 'test3', self.portal.portal_form_controller))
00028             self.assertEqual(len(pt.actions.getFiltered(object_id='test')), 1)
00029             self.assertEqual(pt.actions.match('test', 'success', 'Document', 'submit').getActionArg(), 'test3')
00030 
00031             pt.validators.set(FormValidator(pt.getId(), None, None, 'a,b,c', self.portal.portal_form_controller))
00032             self.assertEqual(len(pt.validators.getFiltered(object_id='test')), 1)
00033             self.assertEqual(pt.validators.match('test', 'Document', 'submit').getValidators(), ['a','b','c'])
00034         
00035             formcontroller.actions.set(FormAction(pt.getId(), 'success', None, None, 'traverse_to', 'test4', self.portal.portal_form_controller))
00036             self.assertEqual(len(formcontroller.actions.getFiltered(object_id='test')), 1)
00037             self.assertEqual(formcontroller.actions.match('test', 'success', 'Document', 'submit').getActionArg(), 'test4')
00038 
00039             formcontroller.validators.set(FormValidator(pt.getId(), None, None, 'd,e,f', self.portal.portal_form_controller))
00040             self.assertEqual(len(formcontroller.validators.getFiltered(object_id='test')), 1)
00041             self.assertEqual(formcontroller.validators.match('test', 'Document', 'submit').getValidators(), ['d','e','f'])
00042 
00043             transaction.savepoint(optimistic=True)
00044 
00045             self.loginAsPortalOwner()
00046             self.folder.manage_renameObjects(['test'], ['test2'])
00047             pt2 = self.folder.test2
00048             self.assertEqual(len(pt2.actions.getFiltered(object_id='test')), 0)
00049             self.assertEqual(len(pt2.actions.getFiltered(object_id='test2')), 1)
00050             self.assertEqual(formcontroller.actions.match('test2', 'success', 'Document', 'submit').getActionArg(), 'test4')
00051             self.assertEqual(formcontroller.actions.match('test', 'success', 'Document', 'submit').getActionArg(), 'test4')
00052 
00053             self.assertEqual(len(pt2.validators.getFiltered(object_id='test')), 0)
00054             self.assertEqual(len(pt2.validators.getFiltered(object_id='test2')), 1)
00055             self.assertEqual(formcontroller.validators.match('test2', 'Document', 'submit').getValidators(), ['d','e','f'])
00056             self.assertEqual(formcontroller.validators.match('test', 'Document', 'submit').getValidators(), ['d','e','f'])
00057 
00058             formcontroller._purge()
00059             self.assertEqual(formcontroller.validators.match('test2', 'Document', 'submit').getValidators(), ['d','e','f'])
00060             self.assertEqual(formcontroller.validators.match('test', 'Document', 'submit'), None)

Here is the call graph for this function:


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