[Zope-CVS] CVS: Packages3/workflow/stateful/tests - test_contentworkflow.py:1.1 test_instance.py:1.5

Ulrich Eck ueck@net-labs.de
Fri, 7 Feb 2003 16:51:24 -0500


Update of /cvs-repository/Packages3/workflow/stateful/tests
In directory cvs.zope.org:/tmp/cvs-serv15434/stateful/tests

Modified Files:
	test_instance.py 
Added Files:
	test_contentworkflow.py 
Log Message:
First usable state of Stateful Workflow :)
- Implemented ProcessInstanceContainer/Adapter + Views
- Implemented Dummy ContentWorkflowsUtility
- updated Readme
- fixed some bugs
 --> read the README for a small tutorial of what works


=== Added File Packages3/workflow/stateful/tests/test_contentworkflow.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.
#
##############################################################################

"""Stateful content workflow utility.

$Id: test_contentworkflow.py,v 1.1 2003/02/07 21:50:53 jack-e Exp $
"""
import unittest

from zope.interface import Interface
from zope.interface.verify import verifyClass

from zope.app.interfaces.workflow.stateful import IContentWorkflowsUtility
from zope.app.workflow.stateful.contentworkflow import ContentWorkflowsUtility



# XXX How to test this without fake a hole zope3-server ?????
class ContentWorkflowsUtilityTests(unittest.TestCase):

    def testInterface(self):
        verifyClass(IContentWorkflowsUtility,
                    ContentWorkflowsUtility)




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

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


=== Packages3/workflow/stateful/tests/test_instance.py 1.4 => 1.5 ===
--- Packages3/workflow/stateful/tests/test_instance.py:1.4	Fri Feb  7 10:29:30 2003
+++ Packages3/workflow/stateful/tests/test_instance.py	Fri Feb  7 16:50:53 2003
@@ -48,7 +48,9 @@
 from zope.app.workflow.stateful.definition \
      import StatefulProcessDefinition, State, Transition
 from zope.app.workflow.stateful.instance \
-     import StatefulProcessInstance
+     import StatefulProcessInstance, StateChangeInfo
+
+
 
 
 # define and create ProcessDefinition (PD) for tests
@@ -63,8 +65,7 @@
 
     value = Int(title=u'an int', default=1)
 
-  
-   
+
 def sort(l):
     l.sort()
     return l
@@ -307,11 +308,30 @@
         self.assertEqual(pi.getOutgoingTransitions(), ['state1_state2'])
 
 
+
+class DummyTransition:
+    def __init__(self, source, destination):
+        self.sourceState = source
+        self.destinationState = destination
+
+
+class TestStateChangeInfo(unittest.TestCase):
+
+    def testStateChangeInfo(self):
+        t = DummyTransition(1,2)
+        sci = StateChangeInfo(t)
+        self.assertEqual(sci.old_state, 1)
+        self.assertEqual(sci.new_state, 2)
+        
+
+
+
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(
         SimpleProcessInstanceTests, ConditionProcessInstanceTests,
-        PermissionProcessInstanceTests))
+        PermissionProcessInstanceTests, TestStateChangeInfo))
     return suite
 
 if __name__ == '__main__':