Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Private Member Functions
CMFPlone.tests.testContentPublishing.TestContentPublishing Class Reference
Inheritance diagram for CMFPlone.tests.testContentPublishing.TestContentPublishing:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.tests.testContentPublishing.TestContentPublishing:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testInstaPublishingDocument
def testInstaPublishingTextFile
def testInstaPublishingWordFile
def testPublishingSubobjects
def testPublishingSubobjectsAndExpireThem
def testPublishingWithoutSubobjects
def testPublishingNonDefaultPageLeavesFolderAlone
def testPublishingDefaultPagePublishesFolder
def testPublishingDefaultPageWhenFolderCannotBePublished
def testIsExpiredWithExplicitExpiredContent
def testIsExpiredWithImplicitExpiredContent
def testIsExpiredWithExplicitNonExpiredContent
def testIsExpiredWithImplicitNonExpiredContent
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 membership
 workflow

Private Member Functions

def _checkMD

Detailed Description

The instant publishing drop down UI.
    !NOTE! CMFDefault.Document overrides setFormat and Format
    so it acts strangely.  This is also hardcoded to work with Document.

    This testcase was written to prevent collector/2914 regressions

    In addition, some more general tests of content_status_modify and
    folder_publish behaviour have been added, since this seems a logical
    place to keep them.

Definition at line 41 of file testContentPublishing.py.


Member Function Documentation

def CMFPlone.tests.testContentPublishing.TestContentPublishing._checkMD (   self,
  obj,
  changes 
) [private]
check the DublinCore Metadata on obj - it must inherit from DublinCore 

Definition at line 60 of file testContentPublishing.py.

00060 
00061     def _checkMD(self, obj, **changes):
00062         """ check the DublinCore Metadata on obj - it must inherit from DublinCore """
00063         if changes:
00064             _orig_props = {}
00065             _orig_props.update(props)
00066             props.update(changes)
00067 
00068         self.assertEqual(obj.Title(), props['title'])
00069         self.assertEqual(obj.Description(), props['description'])
00070         self.assertEqual(obj.Subject(), tuple(props['subject']))
00071         self.assertEqual(obj.ExpirationDate(zone='UTC'),
00072                          obj._datify(props['expiration_date']).ISO())
00073         self.assertEqual(obj.EffectiveDate(zone='UTC'),
00074                          obj._datify(props['effective_date']).ISO())
00075         self.assertEqual(obj.Format(), props['format'])
00076         self.assertEqual(obj.Rights(), props['rights'])
00077         self.assertEqual(obj.Language(), props['language'])
00078         self.assertEqual(obj.Contributors(), tuple(props['contributors']))
00079 
00080         if changes:
00081             props.update(_orig_props)

Here is the caller graph for this function:

Definition at line 53 of file testContentPublishing.py.

00053 
00054     def afterSetUp(self):
00055         self.portal.acl_users._doAddUser('user1', 'secret', ['Member'], [])
00056         self.membership = self.portal.portal_membership
00057         self.createMemberarea('user1')
00058         self.workflow = self.portal.portal_workflow
00059         self.setupAuthenticator()

Definition at line 30 of file PloneTestCase.py.

00030 
00031     def getAuthenticator(self):
00032         tag = AuthenticatorView('context', 'request').authenticator()
00033         pattern = '<input .*name="(\w+)".*value="(\w+)"'
00034         return match(pattern, tag).groups()

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.PloneTestCase.PloneTestCase.setRequestMethod (   self,
  method 
) [inherited]
This is a stub now, but in case you want to try
   something fancy on Your Branch (tm), put it here.

Definition at line 26 of file PloneTestCase.py.

00026 
00027     def setRequestMethod(self, method):
00028         self.app.REQUEST.set('REQUEST_METHOD', method)
00029         self.app.REQUEST.method = method

Here is the caller graph for this function:

Definition at line 35 of file PloneTestCase.py.

00035 
00036     def setupAuthenticator(self):
00037         name, token = self.getAuthenticator()
00038         self.app.REQUEST.form[name] = token
00039 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 82 of file testContentPublishing.py.

00082 
00083     def testInstaPublishingDocument(self):
00084         self.folder.invokeFactory('Document', id='mollusk')
00085         mollusk=self.folder.mollusk
00086         mollusk.document_edit('plain', text, title=props['title'])
00087         self.failUnless(mollusk.CookedBody()!=text)
00088         mollusk.metadata_edit(**props)
00089         self._checkMD(mollusk)
00090         mollusk.content_status_modify(workflow_action='submit')
00091         self._checkMD(mollusk)
00092         mollusk.content_status_modify(workflow_action='retract')
00093         self._checkMD(mollusk)

Here is the call graph for this function:

Definition at line 94 of file testContentPublishing.py.

00094 
00095     def testInstaPublishingTextFile(self):
00096         self.folder.invokeFactory('File', id='lyrics.txt')
00097         lyrics = self.folder['lyrics.txt']
00098         lyrics.file_edit(file=dummy.File('lyrics.txt', data=text))
00099         lyrics.metadata_edit(**props)
00100         self._checkMD(lyrics)
00101         lyrics.content_status_modify(workflow_action='submit')
00102         self._checkMD(lyrics)
00103         lyrics.content_status_modify(workflow_action='retract')
00104         self._checkMD(lyrics)

Here is the call graph for this function:

Definition at line 105 of file testContentPublishing.py.

00105 
00106     def testInstaPublishingWordFile(self):
00107         self.folder.invokeFactory('File', id='lyrics.doc')
00108         lyrics = self.folder['lyrics.doc']
00109         lyrics.file_edit(file=dummy.File('lyrics.doc', data='foo'))
00110         self.failUnless(lyrics.Format()=='application/msword')
00111         lyrics.metadata_edit(description='great song')
00112         self.failUnless(lyrics.Format()=='application/msword')
00113         lyrics.content_status_modify(workflow_action='submit')
00114         self.failUnless(lyrics.Format()=='application/msword')
00115         lyrics.content_status_modify(workflow_action='retract')
00116         self.failUnless(lyrics.Format()=='application/msword')

Here is the call graph for this function:

Definition at line 207 of file testContentPublishing.py.

00207 
00208     def testIsExpiredWithExplicitExpiredContent(self):
00209         self.setRoles(['Manager'])
00210         self.folder.invokeFactory('Document', id = 'd1', title = 'Doc 1')
00211         self.folder.d1.content_status_modify(workflow_action = 'publish',
00212                                              effective_date = '1/1/2001',
00213                                              expiration_date = '1/2/2001')
00214         self.failUnless(self.portal.isExpired(self.folder.d1))

Here is the call graph for this function:

Definition at line 223 of file testContentPublishing.py.

00223 
00224     def testIsExpiredWithExplicitNonExpiredContent(self):
00225         self.setRoles(['Manager'])
00226         self.folder.invokeFactory('Document', id = 'd1', title = 'Doc 1')
00227         self.folder.d1.content_status_modify(workflow_action = 'publish')
00228         self.failIf(self.portal.isExpired(self.folder.d1))

Here is the call graph for this function:

Definition at line 215 of file testContentPublishing.py.

00215 
00216     def testIsExpiredWithImplicitExpiredContent(self):
00217         self.setRoles(['Manager'])
00218         self.folder.invokeFactory('Document', id = 'd1', title = 'Doc 1')
00219         self.folder.d1.content_status_modify(workflow_action = 'publish',
00220                                              effective_date = '1/1/2001',
00221                                              expiration_date = '1/2/2001')
00222         self.failUnless(self.folder.d1.isExpired())

Here is the call graph for this function:

Definition at line 229 of file testContentPublishing.py.

00229 
00230     def testIsExpiredWithImplicitNonExpiredContent(self):
00231         self.setRoles(['Manager'])
00232         self.folder.invokeFactory('Document', id = 'd1', title = 'Doc 1')
00233         self.folder.d1.content_status_modify(workflow_action = 'publish')
00234         self.failIf(self.folder.d1.isExpired())
00235 

Here is the call graph for this function:

Definition at line 185 of file testContentPublishing.py.

00185 
00186     def testPublishingDefaultPagePublishesFolder(self):
00187         self.setRoles(['Manager']) # Make sure we can publish directly
00188         self.folder.invokeFactory('Document', id = 'd1', title = 'Doc 1')
00189         self.folder.setDefaultPage('d1')
00190         self.folder.d1.content_status_modify('publish')
00191         self.assertEqual(self.workflow.getInfoFor(self.folder, 'review_state'), 'published')
00192         self.assertEqual(self.workflow.getInfoFor(self.folder.d1, 'review_state'), 'published')

Here is the call graph for this function:

Definition at line 193 of file testContentPublishing.py.

00193 
00194     def testPublishingDefaultPageWhenFolderCannotBePublished(self):
00195         self.setRoles(['Manager']) # Make sure we can publish directly
00196         self.folder.invokeFactory('Document', id = 'd1', title = 'Doc 1')
00197         self.folder.setDefaultPage('d1')
00198         # make parent be published already when publishing its default document 
00199         # results in an attempt to do it again
00200         self.folder.content_status_modify('publish')
00201         self.assertEqual(self.workflow.getInfoFor(self.folder, 'review_state'), 'published')
00202         self.folder.d1.content_status_modify('publish')
00203         self.assertEqual(self.workflow.getInfoFor(self.folder, 'review_state'), 'published')
00204         self.assertEqual(self.workflow.getInfoFor(self.folder.d1, 'review_state'), 'published')

Here is the call graph for this function:

Definition at line 178 of file testContentPublishing.py.

00178 
00179     def testPublishingNonDefaultPageLeavesFolderAlone(self):
00180         self.setRoles(['Manager']) # Make sure we can publish directly
00181         self.folder.invokeFactory('Document', id = 'd1', title = 'Doc 1')
00182         self.folder.d1.content_status_modify('publish')
00183         self.assertEqual(self.workflow.getInfoFor(self.folder, 'review_state'), 'visible')
00184         self.assertEqual(self.workflow.getInfoFor(self.folder.d1, 'review_state'), 'published')

Here is the call graph for this function:

Definition at line 119 of file testContentPublishing.py.

00119 
00120     def testPublishingSubobjects(self):
00121         self.setRoles(['Manager']) # Make sure we can publish directly
00122         self.folder.invokeFactory('Document', id = 'd1', title = 'Doc 1')
00123         self.folder.invokeFactory('Folder', id = 'f1', title = 'Folder 1')
00124         self.folder.f1.invokeFactory('Document', id = 'd2', title = 'Doc 2')
00125         self.folder.f1.invokeFactory('Folder', id = 'f2', title = 'Folder 2')
00126         paths = []
00127         for o in (self.folder.d1, self.folder.f1):
00128             paths.append('/'.join(o.getPhysicalPath()))
00129 
00130         # folder_publish requires a non-GET request
00131         self.setRequestMethod('POST')
00132         self.folder.folder_publish(workflow_action = 'publish', 
00133                                    paths = paths, 
00134                                    include_children = True)
00135         for o in (self.folder.d1, self.folder.f1, self.folder.f1.d2, self.folder.f1.f2):
00136             self.assertEqual(self.workflow.getInfoFor(o, 'review_state'),'published')

Here is the call graph for this function:

Definition at line 137 of file testContentPublishing.py.

00137 
00138     def testPublishingSubobjectsAndExpireThem(self):
00139         self.setRoles(['Manager']) # Make sure we can publish directly
00140         self.folder.invokeFactory('Document', id = 'd1', title = 'Doc 1')
00141         self.folder.invokeFactory('Folder', id = 'f1', title = 'Folder 1')
00142         self.folder.f1.invokeFactory('Document', id = 'd2', title = 'Doc 2')
00143         self.folder.f1.invokeFactory('Folder', id = 'f2', title = 'Folder 2')
00144         paths = []
00145         for o in (self.folder.d1, self.folder.f1):
00146             paths.append('/'.join(o.getPhysicalPath()))
00147 
00148         # folder_publish requires a non-GET request
00149         self.setRequestMethod('POST')
00150         self.folder.folder_publish(workflow_action = 'publish', 
00151                                    paths = paths, 
00152                                    effective_date = '1/1/2001',
00153                                    expiration_date = '1/2/2001',
00154                                    include_children = True)
00155         for o in (self.folder.d1, self.folder.f1, self.folder.f1.d2, self.folder.f1.f2):
00156             self.assertEqual(self.workflow.getInfoFor(o, 'review_state'),'published')
00157             self.failUnless(self.portal.isExpired(o))

Here is the call graph for this function:

Definition at line 158 of file testContentPublishing.py.

00158 
00159     def testPublishingWithoutSubobjects(self):
00160         self.setRoles(['Manager']) # Make sure we can publish directly
00161         self.folder.invokeFactory('Document', id = 'd1', title = 'Doc 1')
00162         self.folder.invokeFactory('Folder', id = 'f1', title = 'Folder 1')
00163         self.folder.f1.invokeFactory('Document', id = 'd2', title = 'Doc 2')
00164         self.folder.f1.invokeFactory('Folder', id = 'f2', title = 'Folder 2')
00165         paths = []
00166         for o in (self.folder.d1, self.folder.f1):
00167             paths.append('/'.join(o.getPhysicalPath()))
00168 
00169         # folder_publish requires a non-GET request
00170         self.setRequestMethod('POST')
00171         self.folder.folder_publish(workflow_action = 'publish', 
00172                                    paths = paths, 
00173                                    include_children = False)
00174         for o in (self.folder.d1, self.folder.f1):
00175             self.assertEqual( self.workflow.getInfoFor(o, 'review_state'), 'published')
00176         for o in (self.folder.f1.d2, self.folder.f1.f2):
00177             self.assertEqual( self.workflow.getInfoFor(o, 'review_state'), 'visible')

Here is the call graph for this function:


Member Data Documentation

Definition at line 55 of file testContentPublishing.py.

Definition at line 57 of file testContentPublishing.py.


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