[Zope-CVS] CVS: Packages3/workflow/tests - DummyProcessInstance.py:1.1 test_definition.py:1.1 test_instance.py:1.1

Ulrich Eck ueck@net-labs.de
Tue, 4 Feb 2003 16:39:30 -0500


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

Added Files:
	DummyProcessInstance.py test_definition.py test_instance.py 
Log Message:
very basic tests for ProcessInstance, ProcessDefinition (not much to test yet).


=== Added File Packages3/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.
#
##############################################################################

__metaclass__ = type
from zope.app.interfaces.workflow import IProcessInstance
from zope.app.interfaces.workflow import IProcessInstanceControl


class DummyProcessInstance:

    __implements__ = (IProcessInstance, IProcessInstanceControl)

    status = None

    def __init__(self, pd_name, initial_status):
        super(DummyProcessInstance, self).__init__()
        self._pd_name = pd_name
        self._status = initial_status

    ############################################################
    # Implementation methods for interface
    # zope.app.interfaces.workflow.IProcessInstance

    processDefinitionName = property(lambda self: self._pd_name)

    status = property(lambda self: self._status)

    def getWorkitems(self):
        return []

    def getWorkitem(self, wi_id):
        return None

    #
    ############################################################

    ############################################################
    # Implementation methods for interface
    # zope.app.interfaces.workflow.IProcessInstanceControl

    def start(self):
        pass

    def finish(self):
        pass

    #
    ############################################################



=== Added File Packages3/workflow/tests/test_definition.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 zope.interface import Interface
from zope.interface.verify import verifyClass

from zope.app.interfaces.workflow import IProcessDefinition
from zope.app.workflow.definition 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 Packages3/workflow/tests/test_instance.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 zope.interface.verify import verifyClass

from zope.app.interfaces.workflow 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()