[Zope3-checkins] CVS: Zope3/src/zope/app/workflow/tests -
test_definition.py:1.4 test_instance.py:1.5
test_service.py:1.9 workflowsetup.py:1.8
Stephan Richter
srichter at cosmos.phy.tufts.edu
Wed Mar 3 15:20:36 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/workflow/tests
In directory cvs.zope.org:/tmp/cvs-serv21735/src/zope/app/workflow/tests
Modified Files:
test_definition.py test_instance.py test_service.py
workflowsetup.py
Log Message:
Converted process definitions from being arbitrary registerable components to
be local utilities. This drastically simplified the local workflow and process
definition implementation, since they do not have to worry about any
registration stuff anymore. What an improvement!
=== Zope3/src/zope/app/workflow/tests/test_definition.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/workflow/tests/test_definition.py:1.3 Fri Feb 27 11:50:47 2004
+++ Zope3/src/zope/app/workflow/tests/test_definition.py Wed Mar 3 15:20:36 2004
@@ -11,10 +11,10 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""
+"""Process Definition Tests
+
$Id$
"""
-
import unittest
from zope.interface.verify import verifyClass
=== Zope3/src/zope/app/workflow/tests/test_instance.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/workflow/tests/test_instance.py:1.4 Fri Feb 27 11:50:47 2004
+++ Zope3/src/zope/app/workflow/tests/test_instance.py Wed Mar 3 15:20:36 2004
@@ -11,10 +11,10 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""
+"""Process Instance Tests
+
$Id$
"""
-
import unittest
from zope.interface.verify import verifyClass
@@ -29,7 +29,6 @@
from zope.interface import implements
class TestAnnotations(dict):
-
implements(IAnnotations)
class DummyInstance:
=== Zope3/src/zope/app/workflow/tests/test_service.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/workflow/tests/test_service.py:1.8 Fri Feb 27 11:50:47 2004
+++ Zope3/src/zope/app/workflow/tests/test_service.py Wed Mar 3 15:20:36 2004
@@ -11,10 +11,10 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""
+"""Workflow Service Tests
+
$Id$
"""
-
import unittest
from zope.app import zapi
@@ -22,21 +22,19 @@
from zope.interface.verify import verifyClass
from zope.app.container.contained import Contained
from zope.app.interfaces.annotation import IAttributeAnnotatable
-from zope.app.interfaces.services.registration import IRegisterable
-from zope.app.interfaces.services.registration import IRegistered
-from zope.app.interfaces.services.registration import RegisteredStatus
-from zope.app.interfaces.services.registration import ActiveStatus
+from zope.app.interfaces.services.utility import ILocalUtility
+from zope.app.interfaces.services.registration import \
+ RegisteredStatus, ActiveStatus
+from zope.app.services.utility import UtilityRegistration
from zope.app.workflow.tests.workflowsetup import WorkflowSetup
-from zope.app.workflow.interfaces \
- import IWorkflowService, IProcessDefinition
+from zope.app.workflow.interfaces import \
+ IWorkflowService, IProcessDefinition
from zope.app.workflow.service import WorkflowService
-from zope.app.workflow.service import ProcessDefinitionRegistration
# define and create dummy ProcessDefinition (PD) for tests
class DummyProcessDefinition(Contained):
- implements(IProcessDefinition, IAttributeAnnotatable, IRegisterable,
- IRegistered)
+ implements(IProcessDefinition, IAttributeAnnotatable, ILocalUtility)
def __init__(self, n):
self.n = n
@@ -68,18 +66,18 @@
self.default['pd2'] = DummyProcessDefinition(2)
n = self.cm.addRegistration(
- ProcessDefinitionRegistration('definition1',
- '/++etc++site/default/pd1'))
+ UtilityRegistration('definition1', IProcessDefinition,
+ '/++etc++site/default/pd1'))
zapi.traverse(self.default.getRegistrationManager(),
n).status = ActiveStatus
n = self.cm.addRegistration(
- ProcessDefinitionRegistration('definition2',
- '/++etc++site/default/pd2'))
+ UtilityRegistration('definition2', IProcessDefinition,
+ '/++etc++site/default/pd2'))
zapi.traverse(self.default.getRegistrationManager(),
n).status = ActiveStatus
n = self.cm.addRegistration(
- ProcessDefinitionRegistration('definition3',
- '/++etc++site/default/pd1'))
+ UtilityRegistration('definition3', IProcessDefinition,
+ '/++etc++site/default/pd2'))
zapi.traverse(self.default.getRegistrationManager(),
n).status = RegisteredStatus
@@ -90,17 +88,16 @@
self.default1['pd4'] = DummyProcessDefinition(4)
n = self.cm1.addRegistration(
- ProcessDefinitionRegistration(
- 'definition1',
- '/folder1/++etc++site/default/pd3'))
+ UtilityRegistration('definition1', IProcessDefinition,
+ '/folder1/++etc++site/default/pd3'))
zapi.traverse(self.default1.getRegistrationManager(),
n).status = ActiveStatus
n = self.cm1.addRegistration(
- ProcessDefinitionRegistration(
- 'definition4',
- '/folder1/++etc++site/default/pd4'))
+ UtilityRegistration('definition4', IProcessDefinition,
+ '/folder1/++etc++site/default/pd4'))
zapi.traverse(self.default1.getRegistrationManager(),
n).status = ActiveStatus
+
# Now self.service1 overrides definition1, adds new definition4
# available, and inherits definition2 from self.service
=== Zope3/src/zope/app/workflow/tests/workflowsetup.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/workflow/tests/workflowsetup.py:1.7 Wed Jan 14 17:55:29 2004
+++ Zope3/src/zope/app/workflow/tests/workflowsetup.py Wed Mar 3 15:20:36 2004
@@ -11,61 +11,58 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""
-Setup for Placeful Worfklow Tests
-Revision information:
+"""Setup for Placeful Worfklow Tests
+
$Id$
"""
+from zope.interface import implements
+from zope.component.interfaces import IUtilityService
-from zope.component import getService, getServiceManager
-from zope.app.services.servicenames import Permissions
-from zope.app.services.servicenames import Authentication, Workflows
-
-from zope.app.interfaces.security import IAuthenticationService
-from zope.app.interfaces.security import IPermissionService
+from zope.app import zapi
+from zope.app.interfaces.annotation import IAttributeAnnotatable
+from zope.app.interfaces.security import \
+ IAuthenticationService, IPermissionService
from zope.app.security.registries.principalregistry import principalRegistry
from zope.app.security.registries.permissionregistry import permissionRegistry
-
+from zope.app.services.servicenames import \
+ Permissions, Authentication, Workflows, Utilities
from zope.app.services.tests.placefulsetup import PlacefulSetup
-from zope.app.interfaces.annotation import IAttributeAnnotatable
-
-from zope.app.workflow.service import WorkflowService
-
-from zope.interface import implements
-
+from zope.app.services.utility import LocalUtilityService
from zope.app.tests import setup
+from zope.app.workflow.service import WorkflowService
-from zope.app import zapi
class WorkflowServiceForTests(WorkflowService):
-
implements(IAttributeAnnotatable)
class WorkflowSetup(PlacefulSetup):
def setUp(self):
- self.root_sm = getServiceManager(None)
+ self.root_sm = zapi.getServiceManager(None)
self.sm = PlacefulSetup.setUp(self, site=True)
+ setup.addService(self.sm, Utilities, LocalUtilityService())
self.service = setup.addService(self.sm, Workflows,
WorkflowServiceForTests())
self.default = zapi.traverse(self.sm, "default")
self.cm = self.default.getRegistrationManager()
self.sm1 = self.makeSite('folder1')
+ setup.addService(self.sm1, Utilities, LocalUtilityService())
self.service1 = setup.addService(self.sm1, Workflows,
WorkflowServiceForTests())
self.default1 = zapi.traverse(self.sm1, "default")
self.cm1 = self.default1.getRegistrationManager()
+
def setupAuthService(self):
self.root_sm.defineService(Authentication, IAuthenticationService)
self.root_sm.provideService(Authentication, principalRegistry)
- return getService(self.rootFolder, Authentication)
+ return zapi.getService(self.rootFolder, Authentication)
def setupPermissionService(self):
self.root_sm.defineService(Permissions, IPermissionService)
self.root_sm.provideService(Permissions, permissionRegistry)
- return getService(self.rootFolder, Permissions)
+ return zapi.getService(self.rootFolder, Permissions)
More information about the Zope3-Checkins
mailing list