Back to index

plone3  3.1.7
Public Member Functions
CMFEditions.tests.test_CopyModifyMergeRepositoryTool.TestCopyModifyMergeRepositoryTool Class Reference
Inheritance diagram for CMFEditions.tests.test_CopyModifyMergeRepositoryTool.TestCopyModifyMergeRepositoryTool:
Inheritance graph
[legend]
Collaboration diagram for CMFEditions.tests.test_CopyModifyMergeRepositoryTool.TestCopyModifyMergeRepositoryTool:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test00_interface
def test01_saveVersionableAspects
def test02_retrieve
def test03_recursiveRevertOfFolderWithOutsideObject
def test04_isUptoDate
def test05_getHistory
def test06_retrieveWithNoMoreExistentObject
def test07_restoreDeletedObject
def test07_restoreDeletedObjectWithNewId
def test08_purgingDisallowedWithoutPurgingPolicy
def afterSetUp

Detailed Description

Definition at line 84 of file test_CopyModifyMergeRepositoryTool.py.


Member Function Documentation

Reimplemented in CMFEditions.tests.test_CopyModifyMergeRepositoryTool.TestPolicyVersioning.

Definition at line 61 of file test_CopyModifyMergeRepositoryTool.py.

00061 
00062     def afterSetUp(self):
00063         # we need to have the Manager role to be able to add things
00064         # to the portal root
00065         self.setRoles(['Manager',])
00066 
00067         # add an additional user
00068         self.portal.acl_users.userFolderAddUser('reviewer', 'reviewer',
00069                                                 ['Manager'], '')
00070 
00071         # add test data
00072         self.portal.invokeFactory('Document', 'doc')
00073         self.portal.invokeFactory('Link', 'link')
00074         self.portal.invokeFactory('Folder', 'fol')
00075         self.portal.fol.invokeFactory('Document', 'doc1_inside')
00076         self.portal.fol.invokeFactory('Document', 'doc2_inside')
00077         self.portal.fol.invokeFactory('Document', 'doc3_outside')
00078 
00079         self._setupArchivist()

Here is the call graph for this function:

Definition at line 86 of file test_CopyModifyMergeRepositoryTool.py.

00086 
00087     def test00_interface(self):
00088         portal_repository = self.portal.portal_repository
00089         portal_archivist = self.portal.portal_archivist
00090         doc = self.portal.doc
00091 
00092         # test the tools interface conformance
00093         verifyObject(ICopyModifyMergeRepository, portal_repository)
00094         verifyObject(IPurgeSupport, portal_repository)
00095 
00096         # test the version data interface conformance
00097         doc.text = 'text v1'
00098         portal_repository.applyVersionControl(doc, comment='save no 1')
00099 
00100         vdata = portal_repository.retrieve(doc)
00101         verifyObject(IVersionData, vdata)

Definition at line 102 of file test_CopyModifyMergeRepositoryTool.py.

00102 
00103     def test01_saveVersionableAspects(self):
00104         portal_repository = self.portal.portal_repository
00105         portal_archivist = self.portal.portal_archivist
00106         doc = self.portal.doc
00107 
00108         doc.text = 'text v1'
00109         portal_repository.applyVersionControl(doc, comment='save no 1')
00110         doc.text = 'text v2'
00111 
00112         portal_repository.save(doc, comment='save no 2')
00113 
00114         vdata = portal_archivist.retrieve(obj=doc, selector=0)
00115 
00116         self.assertEqual(vdata.data.object.text, 'text v1')
00117         vdata = portal_archivist.retrieve(obj=doc, selector=1)
00118         self.assertEqual(vdata.data.object.text, 'text v2')

Definition at line 119 of file test_CopyModifyMergeRepositoryTool.py.

00119 
00120     def test02_retrieve(self):
00121         portal_repository = self.portal.portal_repository
00122         portal_archivist = self.portal.portal_archivist
00123         doc = self.portal.doc
00124 
00125         doc.text = 'text v1'
00126         portal_repository.applyVersionControl(doc, comment='save no 1')
00127         doc.text = 'text v2'
00128         portal_repository.save(doc, comment='save no 2')
00129 
00130         vdata = portal_repository.retrieve(doc, selector=0)
00131         self.failUnless(verifyObject(IVersionData, vdata))
00132         self.assertEqual(vdata.object.text, 'text v1')
00133         vdata = portal_repository.retrieve(doc, selector=1)
00134         self.assertEqual(vdata.object.text, 'text v2')

Definition at line 135 of file test_CopyModifyMergeRepositoryTool.py.

00135 
00136     def test03_recursiveRevertOfFolderWithOutsideObject(self):
00137         portal_repository = self.portal.portal_repository
00138         portal_archivist = self.portal.portal_archivist
00139         fol = self.portal.fol
00140         doc3_outside = fol.doc3_outside
00141 
00142         fol.title = 'fol title v1'
00143         doc3_outside.title = 'doc3_outside title text v1'
00144         portal_repository.applyVersionControl(fol, comment='save no 1')
00145 
00146         fol.title = 'fol title v2'
00147         doc3_outside.title = 'doc3_outside title text v2'
00148         portal_repository.save(fol, comment='save no 2')
00149 
00150         portal_repository.revert(fol, 0)
00151 
00152         # check result
00153         self.assertEqual(self.portal.fol, fol)
00154         self.assertEqual(self.portal.fol.doc3_outside, doc3_outside)
00155 
00156         self.assertEqual(fol.title, 'fol title v1')
00157         self.assertEqual(doc3_outside.title,
00158                         'doc3_outside title text v2')

Definition at line 159 of file test_CopyModifyMergeRepositoryTool.py.

00159 
00160     def test04_isUptoDate(self):
00161         portal_repository = self.portal.portal_repository
00162         portal_archivist = self.portal.portal_archivist
00163         doc = self.portal.doc
00164 
00165         doc.text = 'text v1'
00166         portal_repository.applyVersionControl(doc, comment='save no 1')
00167         self.assertEqual(portal_repository.isUpToDate(doc), True)
00168         doc.text = 'text v2'
00169         notifyModified(doc)
00170         self.failIf(portal_repository.isUpToDate(doc))

Here is the call graph for this function:

Definition at line 171 of file test_CopyModifyMergeRepositoryTool.py.

00171 
00172     def test05_getHistory(self):
00173         portal_repository = self.portal.portal_repository
00174         portal_archivist = self.portal.portal_archivist
00175         doc = self.portal.doc
00176 
00177         doc.text = 'text v1'
00178         portal_repository.applyVersionControl(doc, comment='save no 1')
00179         hist = portal_repository.getHistory(doc)
00180         self.assertEqual(hist._obj.text, 'text v1')
00181         self.assertEqual(len(hist), 1)
00182 
00183         doc.text = 'text v2'
00184         portal_repository.save(doc, comment='save no 2')
00185         hist = portal_repository.getHistory(doc)
00186         self.assertEqual(hist._obj.text, 'text v2')
00187         self.assertEqual(len(hist), 2)

Definition at line 188 of file test_CopyModifyMergeRepositoryTool.py.

00188 
00189     def test06_retrieveWithNoMoreExistentObject(self):
00190         portal_repository = self.portal.portal_repository
00191         portal_archivist = self.portal.portal_archivist
00192         portal_hidhandler = self.portal.portal_historyidhandler
00193         doc = self.portal.doc
00194 
00195         doc.text = 'text v1'
00196         portal_repository.applyVersionControl(doc, comment='save no 1')
00197         doc.text = 'text v2'
00198         portal_repository.save(doc, comment='save no 2')
00199 
00200         # save the ``history_id`` to be able to retrieve the object after
00201         # it's deletion
00202         history_id = portal_hidhandler.queryUid(doc)
00203 
00204         # delete the object we want to retrieve later
00205         doc_type = doc.getPortalTypeName()
00206         self.portal.manage_delObjects(ids=['doc'])
00207         self.portal.invokeFactory(doc_type, 'doc_tmp')
00208         doc = self.portal.doc_tmp
00209         portal_hidhandler.setUid(doc, history_id, check_uniqueness=True)
00210         vdata = portal_repository.retrieve(doc, selector=0)
00211         self.failUnless(verifyObject(IVersionData, vdata))
00212         self.assertEqual(vdata.object.text, 'text v1')
00213         vdata = portal_repository.retrieve(doc, selector=1)
00214         self.assertEqual(vdata.object.text, 'text v2')

Definition at line 215 of file test_CopyModifyMergeRepositoryTool.py.

00215 
00216     def test07_restoreDeletedObject(self):
00217         portal_repository = self.portal.portal_repository
00218         portal_hidhandler = self.portal.portal_historyidhandler
00219         doc = self.portal.doc
00220 
00221         doc.text = 'text v1'
00222         portal_repository.applyVersionControl(doc, comment='save no 1')
00223 
00224         # save the ``history_id`` to be able to retrieve the object after
00225         # it's deletion
00226         history_id = portal_hidhandler.queryUid(doc)
00227 
00228         # delete the object we want to retrieve later
00229         self.portal.manage_delObjects(ids=['doc'])
00230         self.failIf('doc' in self.portal.objectIds())
00231         vdata = portal_repository.restore(history_id, selector=0, container=self.portal)
00232         self.failUnless('doc' in self.portal.objectIds())
00233         restored = self.portal.doc
00234         self.assertEqual(restored.text, 'text v1')

Here is the call graph for this function:

Definition at line 235 of file test_CopyModifyMergeRepositoryTool.py.

00235 
00236     def test07_restoreDeletedObjectWithNewId(self):
00237         portal_repository = self.portal.portal_repository
00238         portal_hidhandler = self.portal.portal_historyidhandler
00239         doc = self.portal.doc
00240 
00241         doc.text = 'text v1'
00242         portal_repository.applyVersionControl(doc, comment='save no 1')
00243 
00244         # save the ``history_id`` to be able to retrieve the object after
00245         # it's deletion
00246         history_id = portal_hidhandler.queryUid(doc)
00247 
00248         # delete the object we want to retrieve later
00249         self.portal.manage_delObjects(ids=['doc'])
00250         self.failIf('doc' in self.portal.objectIds())
00251         vdata = portal_repository.restore(history_id, selector=0,
00252                                          container=self.portal, new_id='doc2')
00253         self.failUnless('doc2' in self.portal.objectIds())
00254         restored = self.portal.doc2
00255         self.assertEqual(restored.text, 'text v1')

Here is the call graph for this function:

Definition at line 256 of file test_CopyModifyMergeRepositoryTool.py.

00256 
00257     def test08_purgingDisallowedWithoutPurgingPolicy(self):
00258         portal_repository = self.portal.portal_repository
00259         doc = self.portal.doc
00260         
00261         # remove purge policy for this test
00262         portal_purgepolicy = self.portal.portal_purgepolicy
00263         del self.portal.portal_purgepolicy
00264 
00265         doc.text = 'text v1'
00266         portal_repository.applyVersionControl(doc, comment='save no 1')
00267 
00268         self.assertRaises(RepositoryPurgeError,
00269                           portal_repository.purge, doc, selector=0)
00270 
00271         self.portal.portal_purgepolicy = portal_purgepolicy
00272 


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