Back to index

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

List of all members.

Public Member Functions

def test01_recursiveSave
def test02_recursiveRetrieve
def afterSetUp

Private Member Functions

def _setupArchivist

Detailed Description

Definition at line 273 of file test_CopyModifyMergeRepositoryTool.py.


Member Function Documentation

Reimplemented from CMFEditions.tests.test_CopyModifyMergeRepositoryTool.TestCopyModifyMergeRepositoryToolBase.

Definition at line 275 of file test_CopyModifyMergeRepositoryTool.py.

00275 
00276     def _setupArchivist(self):
00277         # replace the "original" tools by dummy tools
00278         tools = (
00279             DummyArchivist(),
00280         )
00281         for tool in tools:
00282             setattr(self.portal, tool.getId(), tool)

Here is the call graph for this function:

Here is the caller graph for this function:

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 283 of file test_CopyModifyMergeRepositoryTool.py.

00283 
00284     def test01_recursiveSave(self):
00285         portal_repository = self.portal.portal_repository
00286         portal_repository.autoapply = False
00287         portal_archivist = self.portal.portal_archivist
00288         fol = self.portal.fol
00289 
00290         portal_archivist.reset_log()
00291         portal_repository.applyVersionControl(fol, comment='save no 1')
00292         portal_repository.save(fol, comment='save no 2')
00293 
00294         # check if correctly recursing and setting reference data correctly
00295         alog_str = portal_archivist.get_log()
00296         expected = """
00297 prepare fol: hid=1, refs=(doc1_inside, doc2_inside, doc3_outside)
00298   prepare doc1_inside: hid=3
00299   save    doc1_inside: hid=3, isreg=False, auto=True
00300   prepare doc2_inside: hid=4
00301   save    doc2_inside: hid=4, isreg=False, auto=True
00302 save    fol: hid=1, irefs=({hid:3, vid:0}, {hid:4, vid:0}), orefs=({hid:None, vid:-1}), isreg=False, auto=True
00303 
00304 prepare fol: hid=1, refs=(doc1_inside, doc2_inside, doc3_outside)
00305   prepare doc1_inside: hid=3
00306   save    doc1_inside: hid=3, isreg=True, auto=False
00307   prepare doc2_inside: hid=4
00308   save    doc2_inside: hid=4, isreg=True, auto=False
00309 save    fol: hid=1, irefs=({hid:3, vid:1}, {hid:4, vid:1}), orefs=({hid:None, vid:-1}), isreg=True, auto=False"""
00310 
00311         self.assertEqual(alog_str, expected)

Definition at line 312 of file test_CopyModifyMergeRepositoryTool.py.

00312 
00313     def test02_recursiveRetrieve(self):
00314         portal_repository = self.portal.portal_repository
00315         portal_archivist = self.portal.portal_archivist
00316         fol = self.portal.fol
00317 
00318         fol.title = 'fol title v1'
00319         fol.doc1_inside.title = 'doc1_inside title text v1'
00320         fol.doc2_inside.title = 'doc2_inside title text v1'
00321         fol.doc3_outside.title = 'doc3_outside title text v1'
00322         portal_repository.applyVersionControl(fol, comment='save no 1')
00323 
00324         fol.title = 'fol title v2'
00325         fol.doc1_inside.title = 'doc1_inside title text v2'
00326         fol.doc2_inside.title = 'doc2_inside title text v2'
00327         fol.doc3_outside.title = 'doc3_outside title text v2'
00328         portal_repository.save(fol, comment='save no 2')
00329 
00330         portal_archivist.reset_log()
00331 
00332         retr = portal_repository.retrieve(fol, selector=0)
00333 
00334         # check recursive retrieve
00335         alog_str = portal_archivist.get_log()
00336 
00337         expected = """retrieve fol: hid=1, selector=0
00338 retrieve doc1_inside: hid=3, selector=0
00339 retrieve doc2_inside: hid=4, selector=0"""
00340         self.assertEqual(alog_str, expected)
00341 
00342         # check result
00343         self.assertEqual(retr.object.title, 'fol title v1')
00344         self.assertEqual(retr.object.doc1_inside.title,
00345                         'doc1_inside title text v1')
00346         self.assertEqual(retr.object.doc2_inside.title,
00347                         'doc2_inside title text v1')
00348         self.assertEqual(retr.object.doc3_outside.title,
00349                         'doc3_outside title text v2')
00350 


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