Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes
CMFTestCase.testDocument.TestDocument Class Reference
Inheritance diagram for CMFTestCase.testDocument.TestDocument:
Inheritance graph
[legend]
Collaboration diagram for CMFTestCase.testDocument.TestDocument:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testAddDocument
def testEditDocument
def testReindexDocument
def testDeleteDocument
def testSubmitDocument
def testRejectDocument
def testAcceptDocument
def testPublishDocument
def testRetractDocument
def getPortal
def createMemberarea
def loginAsPortalOwner
def addProfile
def addProduct

Public Attributes

 membership
 catalog
 workflow

Static Public Attributes

 layer = layer.CMFSite

Detailed Description

Definition at line 15 of file testDocument.py.


Member Function Documentation

def CMFTestCase.CMFTestCase.CMFTestCase.addProduct (   self,
  name 
) [inherited]
Installs a product into the site.

Definition at line 145 of file CMFTestCase.py.

00145 
00146     def addProduct(self, name):
00147         '''Installs a product into the site.'''
00148         sm = getSecurityManager()
00149         self.loginAsPortalOwner()
00150         try:
00151             installed = getattr(self.portal, '_installed_products', {})
00152             if not installed.has_key(name):
00153                 exec 'from Products.%s.Extensions.Install import install' % (name,)
00154                 install(self.portal)
00155                 self._refreshSkinData()
00156         finally:
00157             setSecurityManager(sm)
00158 

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFTestCase.CMFTestCase.CMFTestCase.addProfile (   self,
  name 
) [inherited]
Imports an extension profile into the site.

Definition at line 123 of file CMFTestCase.py.

00123 
00124     def addProfile(self, name):
00125         '''Imports an extension profile into the site.'''
00126         sm = getSecurityManager()
00127         self.loginAsPortalOwner()
00128         try:
00129             installed = getattr(self.portal, '_installed_profiles', {})
00130             if not installed.has_key(name):
00131                 setup = self.portal.portal_setup
00132                 profile_id = 'profile-%s' % (name,)
00133                 if CMF21:
00134                     setup.runAllImportStepsFromProfile(profile_id)
00135                 else:
00136                     saved = setup.getImportContextID()
00137                     try:
00138                         setup.setImportContext(profile_id)
00139                         setup.runAllImportSteps()
00140                     finally:
00141                         setup.setImportContext(saved)
00142                 self._refreshSkinData()
00143         finally:
00144             setSecurityManager(sm)

Here is the call graph for this function:

Definition at line 17 of file testDocument.py.

00017 
00018     def afterSetUp(self):
00019         self.membership = self.portal.portal_membership
00020         self.catalog = self.portal.portal_catalog
00021         self.workflow = self.portal.portal_workflow
00022         self.folder.invokeFactory('Document', id='doc')

def CMFTestCase.CMFTestCase.CMFTestCase.createMemberarea (   self,
  name 
) [inherited]
Creates a minimal memberarea.

Definition at line 93 of file CMFTestCase.py.

00093 
00094     def createMemberarea(self, name):
00095         '''Creates a minimal memberarea.'''
00096         uf = self.portal.acl_users
00097         user = uf.getUserById(name)
00098         if user is None:
00099             raise ValueError, 'Member %s does not exist' % name
00100         if not hasattr(user, 'aq_base'):
00101             user = user.__of__(uf)
00102         pm = self.portal.portal_membership
00103         members = pm.getMembersFolder()
00104         members.manage_addPortalFolder(name)
00105         folder = pm.getHomeFolder(name)
00106         folder.changeOwnership(user)
00107         folder.__ac_local_roles__ = None
00108         folder.manage_setLocalRoles(name, ['Owner'])

Here is the caller graph for this function:

Returns the portal object.

   Do not call this method! Use the self.portal
   attribute to access the portal object from tests.

Definition at line 85 of file CMFTestCase.py.

00085 
00086     def getPortal(self):
00087         '''Returns the portal object.
00088 
00089            Do not call this method! Use the self.portal
00090            attribute to access the portal object from tests.
00091         '''
00092         return getattr(self.app, portal_name)

Here is the caller graph for this function:

Use if - AND ONLY IF - you need to manipulate the
   portal object itself.

Definition at line 111 of file CMFTestCase.py.

00111 
00112     def loginAsPortalOwner(self):
00113         '''Use if - AND ONLY IF - you need to manipulate the
00114            portal object itself.
00115         '''
00116         uf = self.app.acl_users
00117         user = uf.getUserById(portal_owner)
00118         if not hasattr(user, 'aq_base'):
00119             user = user.__of__(uf)
00120         newSecurityManager(None, user)

Definition at line 54 of file testDocument.py.

00054 
00055     def testAcceptDocument(self):
00056         self.workflow.doActionFor(self.folder.doc, 'submit')
00057         self.setRoles(['Reviewer'])
00058         self.workflow.doActionFor(self.folder.doc, 'publish')
00059         self.assertEqual(self.workflow.getInfoFor(self.folder.doc, 'review_state'), 'published')
00060         self.assertEqual(len(self.catalog(getId='doc', review_state='published')), 1)

Here is the call graph for this function:

Definition at line 23 of file testDocument.py.

00023 
00024     def testAddDocument(self):
00025         self.failUnless(hasattr(aq_base(self.folder), 'doc'))
00026         self.failUnless(self.catalog(getId='doc'))

Here is the call graph for this function:

Definition at line 37 of file testDocument.py.

00037 
00038     def testDeleteDocument(self):
00039         self.assertEqual(len(self.catalog(getId='doc')), 1)
00040         self.folder._delObject('doc')
00041         self.assertEqual(len(self.catalog(getId='doc')), 0)

Definition at line 27 of file testDocument.py.

00027 
00028     def testEditDocument(self):
00029         self.folder.doc.edit(text_format='plain', text='data')
00030         self.assertEqual(self.folder.doc.EditableBody(), 'data')

Definition at line 61 of file testDocument.py.

00061 
00062     def testPublishDocument(self):
00063         self.setRoles(['Reviewer'])
00064         self.workflow.doActionFor(self.folder.doc, 'publish')
00065         self.assertEqual(self.workflow.getInfoFor(self.folder.doc, 'review_state'), 'published')
00066         self.assertEqual(len(self.catalog(getId='doc', review_state='published')), 1)

Here is the call graph for this function:

Definition at line 31 of file testDocument.py.

00031 
00032     def testReindexDocument(self):
00033         self.assertEqual(len(self.catalog(getId='doc', Title='Foo')), 0)
00034         self.folder.doc.setTitle('Foo')
00035         self.folder.doc.reindexObject()
00036         self.assertEqual(len(self.catalog(getId='doc', Title='Foo')), 1)

Definition at line 47 of file testDocument.py.

00047 
00048     def testRejectDocument(self):
00049         self.workflow.doActionFor(self.folder.doc, 'submit')
00050         self.setRoles(['Reviewer'])
00051         self.workflow.doActionFor(self.folder.doc, 'reject')
00052         self.assertEqual(self.workflow.getInfoFor(self.folder.doc, 'review_state'), 'private')
00053         self.assertEqual(len(self.catalog(getId='doc', review_state='private')), 1)

Here is the call graph for this function:

Definition at line 67 of file testDocument.py.

00067 
00068     def testRetractDocument(self):
00069         self.setRoles(['Reviewer'])
00070         self.workflow.doActionFor(self.folder.doc, 'publish')
00071         self.setRoles(['Member'])
00072         self.workflow.doActionFor(self.folder.doc, 'retract')
00073         self.assertEqual(self.workflow.getInfoFor(self.folder.doc, 'review_state'), 'private')
00074         self.assertEqual(len(self.catalog(getId='doc', review_state='private')), 1)
00075 

Here is the call graph for this function:

Definition at line 42 of file testDocument.py.

00042 
00043     def testSubmitDocument(self):
00044         self.workflow.doActionFor(self.folder.doc, 'submit')
00045         self.assertEqual(self.workflow.getInfoFor(self.folder.doc, 'review_state'), 'pending')
00046         self.assertEqual(len(self.catalog(getId='doc', review_state='pending')), 1)


Member Data Documentation

Definition at line 19 of file testDocument.py.

Definition at line 62 of file CMFTestCase.py.

Definition at line 18 of file testDocument.py.

Definition at line 20 of file testDocument.py.


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