[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Workflow/tests - testWorkflowService.py:1.2.24.4

Grégoire Weber zope@i-con.ch
Thu, 5 Dec 2002 05:40:10 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/Workflow/tests
In directory cvs.zope.org:/tmp/cvs-serv13991/tests

Modified Files:
      Tag: sprintathon-wf-branch
	testWorkflowService.py 
Log Message:
added testCreateProcessInstance, there are now 4 tests


=== Zope3/lib/python/Zope/App/Workflow/tests/testWorkflowService.py 1.2.24.3 => 1.2.24.4 ===
--- Zope3/lib/python/Zope/App/Workflow/tests/testWorkflowService.py:1.2.24.3	Wed Dec  4 12:15:19 2002
+++ Zope3/lib/python/Zope/App/Workflow/tests/testWorkflowService.py	Thu Dec  5 05:40:08 2002
@@ -51,6 +51,8 @@
 class DummyProcessDefinition:
     __implements__ = IDummyProcessDefinition
 
+    def createProcessInstance(self):
+        return 'dummy_pi'
 
 
 class WorkflowServiceTests(PlacefulSetup, unittest.TestCase):
@@ -74,61 +76,63 @@
         self.sm = sm = traverse(self.rootFolder, '++etc++Services')
         self.default = default = traverse(sm, 'Packages/default')
 
+        # create a workflow service
         ws = WorkflowService()
         default.setObject('ws', ws)
 
+        # configure and set active workflow service 'ws' 
         configuration = ServiceConfiguration(
             'Workflows', '/++etc++Services/Packages/default/ws')
-
         default['configure'].setObject('', configuration)
         traverse(default, 'configure/1').status = Active
 
         self.ws = getService(self.rootFolder, 'Workflows')
 
+        # setup sample process definitions
+        self.pd1, self.pd2 = self.setupProcessDefinitions()
+
+    def testInterface(self):
+        verifyClass(IWorkflowService, WorkflowService)
+
     def setupProcessDefinitions(self):
         default = self.default
-        # create process definition in the default package
+
+        # create a dummy process definition in the default package
         pd1 = DummyProcessDefinition()
         default.setObject('pd1', pd1)
 
-        # 
+        # configure and set active 'pd1' 
         configuration = WorkflowProcessDefinitionConfiguration(
             'pd1_name', '/++etc++Services/Packages/default/pd1')
-
         default['configure'].setObject('', configuration)
         traverse(default, 'configure/2').status = Active
 
-        # 
+        # create another dummy process definition in the default package
         pd2 = DummyProcessDefinition()
         self.default.setObject('pd2', pd2)
 
-        # 
+        # configure and set active 'pd2' 
         configuration = WorkflowProcessDefinitionConfiguration(
             'pd2_name', '/++etc++Services/Packages/default/pd2')
-
         default['configure'].setObject('', configuration)
         traverse(default, 'configure/3').status = Active
 
         return pd1, pd2
 
     def testGetProcessDefiniton(self):
-        pd1, pd2 = self.setupProcessDefinitions()
-
-        self.assertEqual(pd1, self.ws.getProcessDefinition('pd1_name'))
-        self.assertEqual(pd2, self.ws.getProcessDefinition('pd2_name'))
+        self.assertEqual(self.pd1, self.ws.getProcessDefinition('pd1_name'))
+        self.assertEqual(self.pd2, self.ws.getProcessDefinition('pd2_name'))
 
     def testGetProcessDefinitonNames(self):
-        self.setupProcessDefinitions()
-
         pd1_name, pd2_name = self.ws.getProcessDefinitionNames()
+
         self.assertEqual(pd1_name, 'pd1_name')
         self.assertEqual(pd2_name, 'pd2_name')
 
+    def testCreateProcessInstance(self):
+        pi = self.ws.createProcessInstance('pd1_name')
 
-    """
-    def testInterface(self):
-        verifyClass(IWorkflowService, WorkflowService)
-    """
+        self.assertEqual(pi, 'dummy_pi')
 
 
 def test_suite():