[Zope-CVS] CVS: Packages3/workflow/stateful/tests - test_definition.py:1.4 test_instance.py:1.4
Ulrich Eck
ueck@net-labs.de
Fri, 7 Feb 2003 10:29:31 -0500
Update of /cvs-repository/Packages3/workflow/stateful/tests
In directory cvs.zope.org:/tmp/cvs-serv17461/stateful/tests
Modified Files:
test_definition.py test_instance.py
Log Message:
next steps towards a usable Stateful Workflow:
- Schema for ProcessDefinition, State, Transition
- views for TTW-Editing
- another try to get the transition-permissions working (still not done)
- configure optimization
=== Packages3/workflow/stateful/tests/test_definition.py 1.3 => 1.4 ===
--- Packages3/workflow/stateful/tests/test_definition.py:1.3 Thu Feb 6 17:03:07 2003
+++ Packages3/workflow/stateful/tests/test_definition.py Fri Feb 7 10:29:30 2003
@@ -54,7 +54,7 @@
def doMinimalSetup(self):
pd = self.pd
- pd.setSchema(IDummyDataSchema)
+ pd.setRelevantDataSchema(IDummyDataSchema)
self.st1 = st1 = DummyState()
self.st2 = st2 = DummyState()
pd.addState('st1', st1)
@@ -69,7 +69,7 @@
verifyClass(IStatefulProcessDefinition, StatefulProcessDefinition)
def testGetSchema(self):
- self.assertEqual(self.pd.getSchema(), IDummyDataSchema)
+ self.assertEqual(self.pd.getRelevantDataSchema(), IDummyDataSchema)
def testGetStateNames(self):
pd = self.pd
=== Packages3/workflow/stateful/tests/test_instance.py 1.3 => 1.4 ===
--- Packages3/workflow/stateful/tests/test_instance.py:1.3 Thu Feb 6 17:03:07 2003
+++ Packages3/workflow/stateful/tests/test_instance.py Fri Feb 7 10:29:30 2003
@@ -23,10 +23,13 @@
from zope.interface.verify import verifyClass
from zope.schema import Text, Int
+from zope.component.service import serviceManager
+from zope.app.interfaces.security import IPermissionService
+from zope.app.security.registries.permissionregistry \
+ import permissionRegistry
+from zope.component.servicenames import Permissions
from zope.security.management import newSecurityManager
-
-from zope.app.security.grants.principalpermission \
- import principalPermissionManager
+from zope.security.management import system_user
from zope.proxy.context import ContextWrapper
from zope.app.traversing import traverse
@@ -75,7 +78,7 @@
pd = TestProcessDefinition()
- pd.setSchema(ITestDataSchema)
+ pd.setRelevantDataSchema(ITestDataSchema)
pd.states.setObject('private', State())
pd.states.setObject('published', State())
@@ -165,7 +168,7 @@
pd = TestProcessDefinition()
- pd.setSchema(ITestDataSchema)
+ pd.setRelevantDataSchema(ITestDataSchema)
pd.states.setObject('state1', State())
pd.states.setObject('state2', State())
@@ -250,49 +253,32 @@
def setUp(self):
WorkflowSetup.setUp(self)
- # Setup a test principal and role, assing role to principal
- self.auth_svc = self.setupAuthService()
- self.auth_svc.definePrincipal("TestPrincipal", "Test Principal")
- self.principal = self.auth_svc.getPrincipal("TestPrincipal")
- self.principalId = self.principal.getId()
-
- # Setup a permission service
- self.perm_svc = self.setupPermissionService()
- # set up some permissions
- read = self.perm_svc.definePermission('read', 'Read',
- 'Read something')
- self.read = read.getId()
- write = self.perm_svc.definePermission('write', 'Write',
- 'Write something')
- self.write = write.getId()
-
- # grant and deny a permission to principal
- principalPermissionManager.grantPermissionToPrincipal(self.read, self.principalId)
- principalPermissionManager.denyPermissionToPrincipal(self.write, self.principalId)
-
- # switch to security-context of test principal
- newSecurityManager(self.principal)
+ serviceManager.defineService(Permissions, IPermissionService)
+ serviceManager.provideService(Permissions, permissionRegistry)
+ permissionRegistry.definePermission('deny', 'Deny')
+
+ #newSecurityManager(system_user)
+ newSecurityManager('test')
- # create TestProcessDefinition
pd = TestProcessDefinition()
- pd.setSchema(ITestDataSchema)
+ pd.setRelevantDataSchema(ITestDataSchema)
pd.states.setObject('state1', State())
pd.states.setObject('state2', State())
pd.transitions.setObject('initial_state1',
- Transition('INITIAL', 'state1', permission=self.read))
+ Transition('INITIAL', 'state1', permission='zope.Public'))
pd.transitions.setObject('initial_state2',
- Transition('INITIAL', 'state2', permission=self.write))
+ Transition('INITIAL', 'state2', permission='deny'))
pd.transitions.setObject('state1_state2',
- Transition('state1', 'state2', permission=self.read))
+ Transition('state1', 'state2', permission='zope.Public'))
pd.transitions.setObject('state2_state1',
Transition('state2', 'state1'))
pd.transitions.setObject('state1_initial',
- Transition('state1', 'INITIAL', permission=self.write))
+ Transition('state1', 'INITIAL', permission='deny'))
pd.transitions.setObject('state2_initial',
- Transition('state2', 'INITIAL', permission=self.read))
+ Transition('state2', 'INITIAL', permission='zope.Public'))
self.default.setObject('pd1', pd )