Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def testGetTransitionsForProvidesURL
def testGetTransitionsForProvidesDescription
def testGetTitleForStateOnType
def testGetTitleForStateOnTypeFallsBackOnStateId
def testGetTitleForStateOnTypeSucceedsWithNonString
def testGetTitleForTransitionOnType
def testGetTitleForTransitionOnTypeFallsBackOnTransitionId
def testGetTitleForTransitionOnTypeSucceedsWithNonString
def testListWFStatesByTitle
def testAdaptationBasedWorkflowOverride
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 workflow
 doc
 ev

Detailed Description

Definition at line 33 of file testWorkflowTool.py.


Member Function Documentation

Definition at line 35 of file testWorkflowTool.py.

00035 
00036     def afterSetUp(self):
00037         self.workflow = self.portal.portal_workflow
00038 
00039         self.portal.acl_users._doAddUser('member', 'secret', ['Member'], [])
00040         self.portal.acl_users._doAddUser('reviewer', 'secret', ['Reviewer'], [])
00041         self.portal.acl_users._doAddUser('manager', 'secret', ['Manager'], [])
00042 
00043         self.folder.invokeFactory('Document', id='doc')
00044         self.doc = self.folder.doc
00045 
00046         self.folder.invokeFactory('Event', id='ev')
00047         self.ev = self.folder.ev

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 116 of file testWorkflowTool.py.

00116 
00117     def testAdaptationBasedWorkflowOverride(self):
00118         # We take a piece of dummy content and register a dummy
00119         # workflow chain adapter for it.
00120         content = Dummy()
00121         directlyProvides(content, IDocument)
00122         provideAdapter(DummyWorkflowChainAdapter,
00123                         adapts=(IDocument, IWorkflowTool))
00124         self.assertEqual(self.workflow.getChainFor(content),
00125                          ('Static Workflow',))
00126         # undo our registration so we don't break tests
00127         components = getGlobalSiteManager()
00128         components.unregisterAdapter(DummyWorkflowChainAdapter,
00129                                      required=(IDocument, IWorkflowTool))

Here is the call graph for this function:

Definition at line 60 of file testWorkflowTool.py.

00060 
00061     def testGetTitleForStateOnType(self):
00062         state_id = self.workflow.getInfoFor(self.doc, 'review_state', '')
00063         state_title = self.workflow.getTitleForStateOnType(state_id, self.doc.portal_type)
00064         self.assertEqual(state_id, 'visible')
00065         self.assertEqual(state_title.lower(), 'public draft')

Definition at line 66 of file testWorkflowTool.py.

00066 
00067     def testGetTitleForStateOnTypeFallsBackOnStateId(self):
00068         state_id = 'nonsense'
00069         state_title = self.workflow.getTitleForStateOnType(state_id, self.doc.portal_type)
00070         self.assertEqual(state_title, 'nonsense')

Definition at line 71 of file testWorkflowTool.py.

00071 
00072     def testGetTitleForStateOnTypeSucceedsWithNonString(self):
00073         # Related to http://dev.plone.org/plone/ticket/4638
00074         # Non content objects can pass None or MissingValue.
00075         state_id = None
00076         state_title = self.workflow.getTitleForStateOnType(state_id, self.doc.portal_type)
00077         self.assertEqual(state_title, state_id)

Definition at line 78 of file testWorkflowTool.py.

00078 
00079     def testGetTitleForTransitionOnType(self):
00080         state_id = 'hide'
00081         state_title = self.workflow.getTitleForTransitionOnType(state_id, self.doc.portal_type)
00082         self.assertEqual(state_title, 'Make private')

Definition at line 83 of file testWorkflowTool.py.

00083 
00084     def testGetTitleForTransitionOnTypeFallsBackOnTransitionId(self):
00085         state_id = 'nonsense'
00086         state_title = self.workflow.getTitleForTransitionOnType(state_id, self.doc.portal_type)
00087         self.assertEqual(state_title, 'nonsense')

Definition at line 88 of file testWorkflowTool.py.

00088 
00089     def testGetTitleForTransitionOnTypeSucceedsWithNonString(self):
00090         # Related to http://dev.plone.org/plone/ticket/4638
00091         # Non content objects can pass None or MissingValue.
00092         state_id = None
00093         state_title = self.workflow.getTitleForTransitionOnType(state_id, self.doc.portal_type)
00094         self.assertEqual(state_title, state_id)

Definition at line 55 of file testWorkflowTool.py.

00055 
00056     def testGetTransitionsForProvidesDescription(self):
00057         trans = self.workflow.getTransitionsFor(self.doc)
00058         self.assertEqual(len(trans), 2)
00059         self.failUnless(trans[0].has_key('description'))

Definition at line 48 of file testWorkflowTool.py.

00048 
00049     def testGetTransitionsForProvidesURL(self):
00050         trans = self.workflow.getTransitionsFor(self.doc)
00051         self.assertEqual(len(trans), 2)
00052         self.failUnless(trans[0].has_key('url'))
00053         # Test that url has filled in string substitutions for content url
00054         self.failUnless('http://' in trans[0]['url'])

Definition at line 95 of file testWorkflowTool.py.

00095 
00096     def testListWFStatesByTitle(self):
00097         states = self.workflow.listWFStatesByTitle()
00098         self.assertEqual(len(states), len(all_states))
00099         pub_states = [s for s in states if s[1]=='published']
00100         priv_states = [s for s in states if s[1]=='private']
00101         pend_states = [s for s in states if s[1]=='pending']
00102         vis_states = [s for s in states if s[1]=='visible']
00103         external_states = [s for s in states if s[1]=='external']
00104         internal_states = [s for s in states if s[1]=='internal']
00105         internal_pub_states = [s for s in states
00106                                  if s[1]=='internally_published']
00107 
00108         self.assertEqual(len(pub_states), all_states.count('published'))
00109         self.assertEqual(len(priv_states), all_states.count('private'))
00110         self.assertEqual(len(pend_states), all_states.count('pending'))
00111         self.assertEqual(len(vis_states), all_states.count('visible'))
00112         self.assertEqual(len(external_states), all_states.count('external'))
00113         self.assertEqual(len(internal_states), all_states.count('internal'))
00114         self.assertEqual(len(internal_pub_states),
00115                          all_states.count('internally_published'))


Member Data Documentation

Definition at line 43 of file testWorkflowTool.py.

Definition at line 46 of file testWorkflowTool.py.

Definition at line 36 of file testWorkflowTool.py.


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