[Zope-Checkins] CVS: Zope3/lib/python/Zope/Event/tests - testObjectEvent.py:1.1.2.1 __init__.py:1.1.2.1

Chris Withers chrisw@nipltd.com
Fri, 22 Feb 2002 12:02:44 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Event/tests
In directory cvs.zope.org:/tmp/cvs-serv24689/Event/tests

Added Files:
      Tag: Zope-3x-branch
	testObjectEvent.py __init__.py 
Log Message:
SB/CW -  working tests for ObjectEvent

=== Added File Zope3/lib/python/Zope/Event/tests/testObjectEvent.py ===
##############################################################################
#
# Copyright (c) 2001, 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
# 
##############################################################################
"""

Revision information:
$Id: testObjectEvent.py,v 1.1.2.1 2002/02/22 17:02:44 chrisw Exp $
"""

import unittest, sys

from Zope.Event.ObjectEvent import ObjectAddedEvent, ObjectModifiedEvent
from Zope.Event.ObjectEvent import ObjectRemovedEvent, ObjectMovedEvent

class TestObjectAddedEvent(unittest.TestCase):
    
    location = '/some/location'
    klass = ObjectAddedEvent
    
    def setUp(self):
        self.event = self.klass(self.location)
        
    def testGetLocation(self):
        "Test getLocation method"
        self.assertEqual(self.event.getLocation(),self.location)

class TestObjectModifiedEvent(TestObjectAddedEvent):

    klass = ObjectModifiedEvent

class TestObjectRemovedEvent(TestObjectAddedEvent):

    klass = ObjectRemovedEvent

class TestObjectMovedEvent(TestObjectAddedEvent):

    from_location = '/some/other/location'
    
    def setUp(self):
        self.event = ObjectMovedEvent(self.from_location, self.location)

    def testFromLocation(self):
        "Test getFromLocation method"
        self.assertEqual(self.event.getFromLocation(),self.from_location)
        
def test_suite():
    return unittest.TestSuite((
        unittest.makeSuite(TestObjectAddedEvent),
        unittest.makeSuite(TestObjectModifiedEvent),
        unittest.makeSuite(TestObjectRemovedEvent),
        unittest.makeSuite(TestObjectMovedEvent),
        ))

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


=== Added File Zope3/lib/python/Zope/Event/tests/__init__.py ===
##############################################################################
#
# Copyright (c) 2001, 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
# 
##############################################################################
"""

Revision information:
$Id: __init__.py,v 1.1.2.1 2002/02/22 17:02:44 chrisw Exp $
"""