[Zope3-checkins] CVS: Zope3/src/zope/app/workflow/tests - test_service.py:1.2
Steve Alexander
steve@cat-box.net
Tue, 3 Jun 2003 10:36:13 -0400
Update of /cvs-repository/Zope3/src/zope/app/workflow/tests
In directory cvs.zope.org:/tmp/cvs-serv30558/src/zope/app/workflow/tests
Modified Files:
test_service.py
Log Message:
formatting,implements,imports fixes
=== Zope3/src/zope/app/workflow/tests/test_service.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/workflow/tests/test_service.py:1.1 Thu May 8 13:27:20 2003
+++ Zope3/src/zope/app/workflow/tests/test_service.py Tue Jun 3 10:36:13 2003
@@ -19,14 +19,12 @@
import unittest
-from zope.interface import Interface
+from zope.interface import Interface, implements
from zope.interface.verify import verifyClass
from zope.app.traversing import traverse
-from zope.app.container.zopecontainer import ZopeContainerAdapter
from zope.app.interfaces.annotation import IAttributeAnnotatable
-from zope.app.interfaces.services.configuration \
- import IUseConfigurable
+from zope.app.interfaces.services.configuration import IUseConfigurable
from zope.app.interfaces.services.configuration \
import Active, Unregistered, Registered
@@ -39,14 +37,14 @@
# define and create dummy ProcessDefinition (PD) for tests
class DummyProcessDefinition:
- __implements__ = IProcessDefinition, IAttributeAnnotatable, IUseConfigurable
+ implements(IProcessDefinition, IAttributeAnnotatable, IUseConfigurable)
def __init__(self, n):
self.n = n
def __str__(self):
return'PD #%d' % self.n
-
+
def createProcessInstance(self, definition_name):
return 'PI #%d' % self.n
@@ -72,7 +70,8 @@
traverse(self.default.getConfigurationManager(), '3').status = Active
self.cm.setObject('', ProcessDefinitionConfiguration('definition3',
'/++etc++site/default/pd1'))
- traverse(self.default.getConfigurationManager(), '4').status = Registered
+ traverse(self.default.getConfigurationManager(),
+ '4').status = Registered
# Now self.service has definition1 and definition2 available
# and knows about definition3
@@ -85,39 +84,61 @@
self.cm1.setObject('', ProcessDefinitionConfiguration('definition4',
'/folder1/++etc++site/default/pd4'))
traverse(self.default1.getConfigurationManager(), '3').status = Active
- # Now self.service1 overrides definition1, adds new definition4 available,
- # and inherits definition2 from self.service
+ # Now self.service1 overrides definition1, adds new definition4
+ # available, and inherits definition2 from self.service
def testInterface(self):
verifyClass(IWorkflowService, WorkflowService)
def testGetProcessDefiniton(self):
- self.assertEqual('PD #1', str(self.service.getProcessDefinition('definition1')))
- self.assertEqual('PD #2', str(self.service.getProcessDefinition('definition2')))
- self.assertRaises(KeyError, self.service.getProcessDefinition, 'definition3')
- self.assertRaises(KeyError, self.service.getProcessDefinition, 'definition4')
-
- self.assertEqual('PD #3', str(self.service1.getProcessDefinition('definition1')))
- self.assertEqual('PD #2', str(self.service1.getProcessDefinition('definition2')))
- self.assertRaises(KeyError, self.service1.getProcessDefinition, 'definition3')
- self.assertEqual('PD #4', str(self.service1.getProcessDefinition('definition4')))
- self.assertRaises(KeyError, self.service1.getProcessDefinition, 'definition5')
+ self.assertEqual(
+ 'PD #1', str(self.service.getProcessDefinition('definition1')))
+ self.assertEqual(
+ 'PD #2', str(self.service.getProcessDefinition('definition2')))
+ self.assertRaises(
+ KeyError, self.service.getProcessDefinition, 'definition3')
+ self.assertRaises(
+ KeyError, self.service.getProcessDefinition, 'definition4')
+
+ self.assertEqual(
+ 'PD #3', str(self.service1.getProcessDefinition('definition1')))
+ self.assertEqual(
+ 'PD #2', str(self.service1.getProcessDefinition('definition2')))
+ self.assertRaises(
+ KeyError, self.service1.getProcessDefinition, 'definition3')
+ self.assertEqual(
+ 'PD #4', str(self.service1.getProcessDefinition('definition4')))
+ self.assertRaises(
+ KeyError, self.service1.getProcessDefinition, 'definition5')
def testQueryProcessDefinition(self):
- self.assertEqual('PD #1', str(self.service.queryProcessDefinition('definition1')))
- self.assertEqual('PD #2', str(self.service.queryProcessDefinition('definition2')))
- self.assertEqual(None, self.service.queryProcessDefinition('definition3'))
- self.assertEqual('xx', self.service.queryProcessDefinition('definition3', 'xx'))
- self.assertEqual(None, self.service.queryProcessDefinition('definition4'))
- self.assertEqual('xx', self.service.queryProcessDefinition('definition4', 'xx'))
-
- self.assertEqual('PD #3', str(self.service1.queryProcessDefinition('definition1')))
- self.assertEqual('PD #2', str(self.service1.queryProcessDefinition('definition2')))
- self.assertEqual(None, self.service1.queryProcessDefinition('definition3'))
- self.assertEqual('xx', self.service1.queryProcessDefinition('definition3', 'xx'))
- self.assertEqual('PD #4', str(self.service1.queryProcessDefinition('definition4')))
- self.assertEqual(None, self.service1.queryProcessDefinition('definition5'))
- self.assertEqual('xx', self.service1.queryProcessDefinition('definition5', 'xx'))
+ self.assertEqual(
+ 'PD #1', str(self.service.queryProcessDefinition('definition1')))
+ self.assertEqual(
+ 'PD #2', str(self.service.queryProcessDefinition('definition2')))
+ self.assertEqual(
+ None, self.service.queryProcessDefinition('definition3'))
+ self.assertEqual(
+ 'xx', self.service.queryProcessDefinition('definition3', 'xx'))
+ self.assertEqual(
+ None, self.service.queryProcessDefinition('definition4'))
+ self.assertEqual(
+ 'xx', self.service.queryProcessDefinition('definition4', 'xx'))
+
+ self.assertEqual(
+ 'PD #3', str(self.service1.queryProcessDefinition('definition1')))
+ self.assertEqual(
+ 'PD #2', str(self.service1.queryProcessDefinition('definition2')))
+ self.assertEqual(
+ None, self.service1.queryProcessDefinition('definition3'))
+ self.assertEqual(
+ 'xx', self.service1.queryProcessDefinition('definition3', 'xx'))
+ self.assertEqual(
+ 'PD #4', str(self.service1.queryProcessDefinition('definition4')))
+ self.assertEqual(
+ None, self.service1.queryProcessDefinition('definition5'))
+ self.assertEqual(
+ 'xx', self.service1.queryProcessDefinition('definition5', 'xx'))
def testGetProcessDefinitonNames(self):