[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Workflow/tests - DummyWorkflowProcessInstance.py:1.1.2.1 testWorkflowDefinition.py:1.1.2.1 testWorkflowProcessDefinition.py:1.1.2.1 testWorkflowProcessInstance.py:1.2.24.1

Florent Guillaume fg@nuxeo.com
Wed, 4 Dec 2002 06:15:29 -0500


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

Modified Files:
      Tag: sprintathon-wf-branch
	testWorkflowProcessInstance.py 
Added Files:
      Tag: sprintathon-wf-branch
	DummyWorkflowProcessInstance.py testWorkflowDefinition.py 
	testWorkflowProcessDefinition.py 
Log Message:
Simple empty process definition. For the engine part, use a separate
interface. Create a dummy implementation of a process instance for testing
purposes.



=== Added File Zope3/lib/python/Zope/App/Workflow/tests/DummyWorkflowProcessInstance.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################

from Zope.App.Workflow.IWorkflowProcessInstance import IWorkflowProcessInstance
from Zope.App.Workflow.IWorkflowEngine import IWorkflowEngine


class DummyWorkflowProcessInstance:

    __implements__ =  (IWorkflowProcessInstance, IWorkflowEngine)

    status = None

    def __init__(self, processDefinition):
        super(DummyWorkflowProcessInstance, self).__init__(self)
        self.__process_definition = processDefinition

    ############################################################
    # Implementation methods for interface
    # Zope.App.Workflow.IWorkflowProcessInstance.IWorkflowProcessInstance

    processDefinition = property(lambda self: self.__process_definition)

    def getWorkitems(self):
        return []

    def getWorkitem(self, wi_id):
        return None

    #
    ############################################################

    ############################################################
    # Implementation methods for interface
    # Zope.App.Workflow.IWorkflowProcessInstance.IWorkflowEngine

    def start(self):
        pass

    def finish(self):
        pass

    #
    ############################################################



=== Added File Zope3/lib/python/Zope/App/Workflow/tests/testWorkflowDefinition.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################

import unittest

from Interface import Interface
from Interface.Verify import verifyClass

from Zope.App.Workflow.IWorkflowService import IWorkflowService
from Zope.App.Workflow.WorkflowService import WorkflowService


class WorkflowServiceTests(unittest.TestCase):

    def createService(self):
        service = WorkflowService()
        return service

    def testInterface(self):
        verifyClass(IWorkflowService, WorkflowService)

    def testGetEngine(self):
        service = self.createService()
        #self.assertEqual(service.getEngine(engineInterface), [])


def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(
        WorkflowServiceTests))
    return suite

if __name__ == '__main__':
    unittest.main()


=== Added File Zope3/lib/python/Zope/App/Workflow/tests/testWorkflowProcessDefinition.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################

import unittest

from Interface import Interface
from Interface.Verify import verifyClass

from Zope.App.Workflow.IWorkflowProcessDefinition import \
     IWorkflowProcessDefinition
from Zope.App.Workflow.WorkflowProcessDefinition import \
     WorkflowProcessDefinition


class WorkflowPDTests(unittest.TestCase):

    def testInterface(self):
        verifyClass(IWorkflowProcessDefinition, WorkflowProcessDefinition)

    def testPDCreation(self):
        pd = WorkflowProcessDefinition()
        pi = pd.createProcessInstance()

def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(
        WorkflowPDTests))
    return suite

if __name__ == '__main__':
    unittest.main()


=== Zope3/lib/python/Zope/App/Workflow/tests/testWorkflowProcessInstance.py 1.2 => 1.2.24.1 ===
--- Zope3/lib/python/Zope/App/Workflow/tests/testWorkflowProcessInstance.py:1.2	Mon Jun 10 19:28:18 2002
+++ Zope3/lib/python/Zope/App/Workflow/tests/testWorkflowProcessInstance.py	Wed Dec  4 06:15:28 2002
@@ -1,40 +1,36 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Corporation and Contributors.
 # All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
-# 
+#
 ##############################################################################
-import unittest
 
+import unittest
 
-class WorkflowProcessInstanceTests( unittest.TestCase ):
+from Interface.Verify import verifyClass
+from Zope.App.Workflow.IWorkflowProcessInstance \
+     import IWorkflowProcessInstance
+from Zope.App.Workflow.tests.DummyWorkflowProcessInstance \
+     import DummyWorkflowProcessInstance
 
-    def testInterface( self ):
-        from Interface.Verify import verifyClass
-        from Zope.App.Workflow.IWorkflowProcessInstance \
-            import IWorkflowProcessInstance
-        from Zope.App.Workflow.WorkflowProcessInstance \
-            import WorkflowProcessInstance
+class WorkflowProcessInstanceTests(unittest.TestCase):
 
-        verifyClass( IWorkflowProcessInstance, WorkflowProcessInstance )
+    def testInterface(self):
+        verifyClass(IWorkflowProcessInstance, DummyWorkflowProcessInstance)
 
 
 def test_suite():
-
     suite = unittest.TestSuite()
-    suite.addTest(
-        unittest.defaultTestLoader.loadTestsFromTestCase(
-            WorkflowProcessInstanceTests ) )
+    suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(
+        WorkflowProcessInstanceTests))
     return suite
-
-
 
 if __name__ == '__main__':
     unittest.main()