[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Workflow/tests - DummyProcessInstance.py:1.1.2.1 testDefinition.py:1.1.2.1 testProcessDefinition.py:1.1.2.1 testProcessInstance.py:1.1.2.1 testService.py:1.1.2.1 DummyWorkflowProcessInstance.py:NONE testWorkflowDefinition.py:NONE testWorkflowProcessDefinition.py:NONE testWorkflowProcessInstance.py:NONE testWorkflowService.py:NONE
Florent Guillaume
fg@nuxeo.com
Thu, 5 Dec 2002 11:44:40 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Workflow/tests
In directory cvs.zope.org:/tmp/cvs-serv27144/tests
Added Files:
Tag: sprintathon-wf-branch
DummyProcessInstance.py testDefinition.py
testProcessDefinition.py testProcessInstance.py testService.py
Removed Files:
Tag: sprintathon-wf-branch
DummyWorkflowProcessInstance.py testWorkflowDefinition.py
testWorkflowProcessDefinition.py
testWorkflowProcessInstance.py testWorkflowService.py
Log Message:
Big renaming, remove the Workflow prefix in most cases. It's redundant
and makes for very long lines.
=== Added File Zope3/lib/python/Zope/App/Workflow/tests/DummyProcessInstance.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.IProcessInstance import IProcessInstance
from Zope.App.Workflow.IProcessInstanceControl import IProcessInstanceControl
class DummyProcessInstance:
__implements__ = (IProcessInstance, IProcessInstanceControl)
status = None
def __init__(self, processDefinition):
super(DummyProcessInstance, self).__init__(self)
self.__process_definition = processDefinition
############################################################
# Implementation methods for interface
# Zope.App.Workflow.IProcessInstance.IProcessInstance
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.IProcessInstanceControl.IProcessInstanceControl
def start(self):
pass
def finish(self):
pass
#
############################################################
=== Added File Zope3/lib/python/Zope/App/Workflow/tests/testDefinition.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/testProcessDefinition.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.IProcessDefinition import IProcessDefinition
from Zope.App.Workflow.ProcessDefinition import ProcessDefinition
class ProcessDefinitionTests(unittest.TestCase):
def testInterface(self):
verifyClass(IProcessDefinition, ProcessDefinition)
def testPDCreation(self):
pd = ProcessDefinition()
pi = pd.createProcessInstance()
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(
ProcessDefinitionTests))
return suite
if __name__ == '__main__':
unittest.main()
=== Added File Zope3/lib/python/Zope/App/Workflow/tests/testProcessInstance.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.Verify import verifyClass
from Zope.App.Workflow.IProcessInstance import IProcessInstance
from Zope.App.Workflow.tests.DummyProcessInstance import DummyProcessInstance
class ProcessInstanceTests(unittest.TestCase):
def testInterface(self):
verifyClass(IProcessInstance, DummyProcessInstance)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(
ProcessInstanceTests))
return suite
if __name__ == '__main__':
unittest.main()
=== Added File Zope3/lib/python/Zope/App/Workflow/tests/testService.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.
#
##############################################################################
"""
Revision information:
$Id: testService.py,v 1.1.2.1 2002/12/05 16:44:39 efge Exp $
"""
import unittest
from Interface import Interface
from Interface.Verify import verifyClass
from Zope.ComponentArchitecture \
import getServiceManager, getService
from Zope.ComponentArchitecture.GlobalServiceManager \
import serviceManager, defineService
from Zope.App.OFS.Services.ConfigurationInterfaces \
import Active, Unregistered, Registered
from Zope.App.OFS.Services.ServiceManager.ServiceManager \
import ServiceManager
from Zope.App.OFS.Services.ServiceManager.tests.PlacefulSetup \
import PlacefulSetup
from Zope.App.OFS.Services.ServiceManager.ServiceConfiguration \
import ServiceConfiguration
from Zope.App.Traversing import traverse
from Zope.App.Workflow.IWorkflowService import IWorkflowService
from Zope.App.Workflow.WorkflowService import WorkflowService
from Zope.App.Workflow.ProcessDefinitionConfiguration \
import ProcessDefinitionConfiguration
# define and create dummy ProcessDefinition (PD) for tests
class IDummyProcessDefinition(Interface):
pass
class DummyProcessDefinition:
__implements__ = IDummyProcessDefinition
def createProcessInstance(self):
return 'dummy_pi'
class WorkflowServiceTests(PlacefulSetup, unittest.TestCase):
# override the PlacefulSetup's testServiceManager by a real
# ServiceManager
def createServiceManager(self):
self.rootFolder.setServiceManager(ServiceManager())
def setUp(self):
PlacefulSetup.setUp(self)
self.buildFolders()
# we say to the global service manager that there is
# a workflow service which fullfills IWorkflowService
root_sm = getServiceManager(None)
root_sm.defineService('Workflows', IWorkflowService)
# create a service manager in rootFolder (default)
self.createServiceManager()
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 a dummy process definition in the default package
pd1 = DummyProcessDefinition()
default.setObject('pd1', pd1)
# configure and set active 'pd1'
configuration = ProcessDefinitionConfiguration(
'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 = ProcessDefinitionConfiguration(
'pd2_name', '/++etc++Services/Packages/default/pd2')
default['configure'].setObject('', configuration)
traverse(default, 'configure/3').status = Active
return pd1, pd2
def testGetProcessDefiniton(self):
self.assertEqual(self.pd1, self.ws.getProcessDefinition('pd1_name'))
self.assertEqual(self.pd2, self.ws.getProcessDefinition('pd2_name'))
def testGetProcessDefinitonNames(self):
names = list(self.ws.getProcessDefinitionNames())
names = names.sort()
oknames = ['pd1_name', 'pd2_name']
oknames = oknames.sort()
self.assertEqual(names, oknames)
def testCreateProcessInstance(self):
pi = self.ws.createProcessInstance('pd1_name')
self.assertEqual(pi, 'dummy_pi')
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(
WorkflowServiceTests))
return suite
if __name__ == '__main__':
unittest.main()
=== Removed File Zope3/lib/python/Zope/App/Workflow/tests/DummyWorkflowProcessInstance.py ===
=== Removed File Zope3/lib/python/Zope/App/Workflow/tests/testWorkflowDefinition.py ===
=== Removed File Zope3/lib/python/Zope/App/Workflow/tests/testWorkflowProcessDefinition.py ===
=== Removed File Zope3/lib/python/Zope/App/Workflow/tests/testWorkflowProcessInstance.py ===
=== Removed File Zope3/lib/python/Zope/App/Workflow/tests/testWorkflowService.py ===