Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
CMFEditions.tests.test_ContentTypes.TestPloneContents Class Reference

List of all members.

Public Member Functions

def afterSetUp
def getPermissionsOfRole
def metadata_test_one
def metadata_test_two
def testDocument
def testNewsItem
def testImage
def testFile
def testFolder

Public Attributes

 membership
 catalog
 workflow
 portal_repository
 portal_archivist

Detailed Description

Definition at line 9 of file test_ContentTypes.py.


Member Function Documentation

Definition at line 11 of file test_ContentTypes.py.

00011 
00012     def afterSetUp(self):
00013         self.membership = self.portal.portal_membership
00014         self.catalog = self.portal.portal_catalog
00015         self.workflow = self.portal.portal_workflow
00016         self.portal_repository = self.portal.portal_repository
00017         self.portal_archivist = self.portal.portal_archivist

Definition at line 18 of file test_ContentTypes.py.

00018 
00019     def getPermissionsOfRole(self, role):
00020         perms = self.portal.permissionsOfRole(role)
00021         return [p['name'] for p in perms if p['selected']]

Here is the caller graph for this function:

Definition at line 22 of file test_ContentTypes.py.

00022 
00023     def metadata_test_one(self, obj):
00024         self.assertEqual(obj.Title(), 'content')
00025         self.assertEqual(obj.Subject(), ('content',))
00026         self.assertEqual(obj.Description(), 'content')
00027         self.assertEqual(obj.Contributors(), ('content',))
00028         self.assertEqual(obj.Language(), 'content')
00029         self.assertEqual(obj.Rights(), 'content')

Here is the caller graph for this function:

Definition at line 30 of file test_ContentTypes.py.

00030 
00031     def metadata_test_two(self, obj):
00032         self.assertEqual(obj.Title(), 'contentOK')
00033         self.assertEqual(obj.Subject(), ('contentOK',))
00034         self.assertEqual(obj.Description(), 'contentOK')
00035         self.assertEqual(obj.Contributors(), ('contentOK',))
00036         self.assertEqual(obj.Language(), 'contentOK')
00037         self.assertEqual(obj.Rights(), 'contentOK')

Here is the caller graph for this function:

Definition at line 38 of file test_ContentTypes.py.

00038 
00039     def testDocument(self):
00040         self.folder.invokeFactory('Document', id='doc')
00041         portal_repository = self.portal_repository
00042         portal_archivist = self.portal_archivist
00043         content = self.folder.doc
00044         content.edit('text/plain','text v1')
00045         content.editMetadata(title='content',
00046                               subject=['content'],
00047                               description='content',
00048                               contributors='content',
00049                               format='text/plain',
00050                               language='content',
00051                               rights='content',
00052                               )
00053         portal_repository.applyVersionControl(content, comment='save no 1')
00054         content.edit('text/plain','text v2')
00055         content.editMetadata(title='contentOK',
00056                               subject=['contentOK'],
00057                               description='contentOK',
00058                               contributors='contentOK',
00059                               format='text/plain',
00060                               language='contentOK',
00061                               rights='contentOK',
00062                               )
00063         portal_repository.save(content, comment='save no 2')
00064         obj = portal_repository.retrieve(content, 0).object
00065         self.assertEqual(obj.EditableBody(), 'text v1')
00066         self.metadata_test_one(obj)
00067         obj = portal_repository.retrieve(content, 1).object
00068         self.assertEqual(obj.EditableBody(), 'text v2')
00069         self.metadata_test_two(obj)
00070         portal_repository.revert(content, 0)
00071         self.assertEqual(content.EditableBody(), 'text v1')
00072         self.metadata_test_one(content)

Here is the call graph for this function:

Definition at line 145 of file test_ContentTypes.py.

00145 
00146     def testFile(self):
00147         self.folder.invokeFactory('Image', id='file')
00148         file1 = open(os.path.join(PACKAGE_HOME, 'tests/images/img1.png'), 'rb').read()
00149         file2 = open(os.path.join(PACKAGE_HOME, 'tests/images/img2.png'), 'rb').read()
00150         portal_repository = self.portal_repository
00151         portal_archivist = self.portal_archivist
00152         content = self.folder.file
00153         content.edit(file=file1)
00154         content.editMetadata(title='content',
00155                               subject=['content'],
00156                               description='content',
00157                               contributors='content',
00158                               format='image/png',
00159                               language='content',
00160                               rights='content',
00161                               )
00162         portal_repository.applyVersionControl(content, comment='save no 1')
00163         content.edit(file=file2)
00164         content.editMetadata(title='contentOK',
00165                               subject=['contentOK'],
00166                               description='contentOK',
00167                               contributors='contentOK',
00168                               format='image/png',
00169                               language='contentOK',
00170                               rights='contentOK',
00171                               )
00172         portal_repository.save(content, comment='save no 2')
00173         obj = portal_repository.retrieve(content, 0).object
00174         self.assertEqual(obj.data, file1)
00175         self.metadata_test_one(obj)
00176         obj = portal_repository.retrieve(content, 1).object
00177         self.assertEqual(obj.data, file2)
00178         self.metadata_test_two(obj)
00179         portal_repository.revert(content, 0)
00180         self.assertEqual(content.data, file1)
00181         self.metadata_test_one(content)

Here is the call graph for this function:

Definition at line 182 of file test_ContentTypes.py.

00182 
00183     def testFolder(self):
00184         self.folder.invokeFactory('Image', id='folder')
00185         portal_repository = self.portal_repository
00186         portal_archivist = self.portal_archivist
00187         content = self.folder.folder
00188         # Use private method because webDAV locking is tripping this up
00189         # using the public method and ATCT
00190         content._editMetadata(title='content',
00191                               subject=['content'],
00192                               description='content',
00193                               contributors='content',
00194                               format='image/png',
00195                               language='content',
00196                               rights='content',
00197                               )
00198         portal_repository.applyVersionControl(content, comment='save no 1')
00199         content._editMetadata(title='contentOK',
00200                               subject=['contentOK'],
00201                               description='contentOK',
00202                               contributors='contentOK',
00203                               format='image/png',
00204                               language='contentOK',
00205                               rights='contentOK',
00206                               )
00207         portal_repository.save(content, comment='save no 2')
00208         obj = portal_repository.retrieve(content, 0).object
00209         self.metadata_test_one(obj)
00210         obj = portal_repository.retrieve(content, 1).object
00211         self.metadata_test_two(obj)
00212         portal_repository.revert(content, 0)
00213         self.metadata_test_one(content)
00214 

Here is the call graph for this function:

Definition at line 108 of file test_ContentTypes.py.

00108 
00109     def testImage(self):
00110         self.folder.invokeFactory('Image', id='image')
00111         portal_repository = self.portal_repository
00112         portal_archivist = self.portal_archivist
00113         img1 = open(os.path.join(PACKAGE_HOME, 'tests/images/img1.png'), 'rb').read()
00114         img2 = open(os.path.join(PACKAGE_HOME, 'tests/images/img2.png'), 'rb').read()
00115         content = self.folder.image
00116         content.edit(file=img1)
00117         content.editMetadata(title='content',
00118                               subject=['content'],
00119                               description='content',
00120                               contributors='content',
00121                               format='image/png',
00122                               language='content',
00123                               rights='content',
00124                               )
00125         portal_repository.applyVersionControl(content, comment='save no 1')
00126         content.edit(file=img2)
00127         content.editMetadata(title='contentOK',
00128                               subject=['contentOK'],
00129                               description='contentOK',
00130                               contributors='contentOK',
00131                               format='image/png',
00132                               language='contentOK',
00133                               rights='contentOK',
00134                               )
00135         portal_repository.save(content, comment='save no 2')
00136         obj = portal_repository.retrieve(content, 0).object
00137         self.assertEqual(obj.data, img1)
00138         self.metadata_test_one(obj)
00139         obj = portal_repository.retrieve(content, 1).object
00140         self.assertEqual(obj.data, img2)
00141         self.metadata_test_two(obj)
00142         portal_repository.revert(content, 0)
00143         self.assertEqual(content.data, img1)
00144         self.metadata_test_one(content)

Here is the call graph for this function:

Definition at line 73 of file test_ContentTypes.py.

00073 
00074     def testNewsItem(self):
00075         self.folder.invokeFactory('News Item', id='news_one')
00076         portal_repository = self.portal_repository
00077         portal_archivist = self.portal_archivist
00078         content = self.folder.news_one
00079         content.edit('text v1', text_format='text/plain')
00080         content.editMetadata(title='content',
00081                               subject=['content'],
00082                               description='content',
00083                               contributors='content',
00084                               format='text/plain',
00085                               language='content',
00086                               rights='content',
00087                               )
00088         portal_repository.applyVersionControl(content, comment='save no 1')
00089         content.edit('text v2', text_format='text/plain')
00090         content.editMetadata(title='contentOK',
00091                               subject=['contentOK'],
00092                               description='contentOK',
00093                               contributors='contentOK',
00094                               format='text/plain',
00095                               language='contentOK',
00096                               rights='contentOK',
00097                               )
00098         portal_repository.save(content, comment='save no 2')
00099         obj = portal_repository.retrieve(content, 0).object
00100         self.assertEqual(obj.EditableBody(), 'text v1')
00101         self.metadata_test_one(obj)
00102         obj = portal_repository.retrieve(content, 1).object
00103         self.assertEqual(obj.EditableBody(), 'text v2')
00104         self.metadata_test_two(obj)
00105         portal_repository.revert(content, 0)
00106         self.assertEqual(content.EditableBody(), 'text v1')
00107         self.metadata_test_one(content)

Here is the call graph for this function:


Member Data Documentation

Definition at line 13 of file test_ContentTypes.py.

Definition at line 12 of file test_ContentTypes.py.

Definition at line 16 of file test_ContentTypes.py.

Definition at line 15 of file test_ContentTypes.py.

Definition at line 14 of file test_ContentTypes.py.


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