Back to index

plone3  3.1.7
Public Member Functions
plone.app.layout.viewlets.tests.test_history.TestWorkflowHistoryViewlet Class Reference
Inheritance diagram for plone.app.layout.viewlets.tests.test_history.TestWorkflowHistoryViewlet:
Inheritance graph
[legend]
Collaboration diagram for plone.app.layout.viewlets.tests.test_history.TestWorkflowHistoryViewlet:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def addMember
def delMember
def test_emptyHistory
def test_transitionHistory

Detailed Description

Test the workflow history viewlet

Definition at line 6 of file test_history.py.


Member Function Documentation

def plone.app.layout.viewlets.tests.test_history.TestWorkflowHistoryViewlet.addMember (   self,
  username,
  roles = ('Member', 
)

Definition at line 15 of file test_history.py.

00015 
00016     def addMember(self, username, roles=('Member',)):
00017         self.portal.portal_membership.addMember(username, 'secret', roles, [])

Here is the caller graph for this function:

Definition at line 10 of file test_history.py.

00010 
00011     def afterSetUp(self):
00012         # add document, perform transition, set history for non-existent
00013         # member and also None (anonymous)
00014         self.folder.invokeFactory('Document', 'd1')

Definition at line 18 of file test_history.py.

00018 
00019     def delMember(self, username):
00020         self.portal.portal_membership.deleteMembers([username])

Here is the caller graph for this function:

Definition at line 21 of file test_history.py.

00021 
00022     def test_emptyHistory(self):
00023         request = self.app.REQUEST
00024         context = getattr(self.folder, 'd1')
00025         viewlet = WorkflowHistoryViewlet(context, request, None, None)
00026         viewlet.update()
00027         self.assertEqual(viewlet.workflowHistory(), [])

Here is the call graph for this function:

Definition at line 28 of file test_history.py.

00028 
00029     def test_transitionHistory(self):
00030         wf_tool = self.portal.portal_workflow
00031         request = self.app.REQUEST
00032         context = getattr(self.folder, 'd1')
00033         self.loginAsPortalOwner()
00034         wf_tool.doActionFor(context, 'publish')
00035 
00036         viewlet = WorkflowHistoryViewlet(context, request, None, None)
00037         viewlet.update()
00038 
00039         history = viewlet.workflowHistory()
00040         self.assertEqual(len(history), 1)
00041         self.assertEqual(history[0]['action'], 'publish')
00042 
00043         # add a temporary user to perform a transition
00044         self.addMember('tempuser', roles=('Member', 'Manager'))
00045         self.login('tempuser')
00046         wf_tool.doActionFor(context, action='retract', actor=None)
00047         self.logout()
00048 
00049         self.loginAsPortalOwner()
00050 
00051         # remove the user
00052         self.delMember('tempuser')
00053 
00054         # if the user that performed the transition no longer exists, the link
00055         # shouldn't be included.
00056         viewlet = WorkflowHistoryViewlet(context, request, None, None)
00057         viewlet.update()
00058         history = viewlet.workflowHistory()
00059 
00060         self.assertEqual(len(history), 2)
00061         self.assertEqual(history[0]['actor_home'], '')
00062 

Here is the call graph for this function:


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