[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/Folder/tests - testFolderLimit.py:1.1.2.1
Christian Theune
ct@gocept.com
Sat, 18 May 2002 06:21:50 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/Folder/tests
In directory cvs.zope.org:/tmp/cvs-serv29411
Added Files:
Tag: ctheune-foldermove-branch
testFolderLimit.py
Log Message:
Renamed testFolderLimit.py to ../../Content/Folder/tests/testFolderLimit.py
=== Added File Zope3/lib/python/Zope/App/OFS/Content/Folder/tests/testFolderLimit.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.
#
##############################################################################
import unittest
from Zope.App.OFS.Folder.LoadedFolder import LoadedFolder
from Zope.App.OFS.Folder.FolderLimit import FolderLimitExceededError
class Object:
"""Object stub"""
class Test( unittest.TestCase ):
def testSetLimit( self ):
""" """
loadedfolder = LoadedFolder()
loadedfolder.setLimit(5)
self.assertEquals( loadedfolder._limit, 5 )
def testGetLimit( self ):
""" """
loadedfolder = LoadedFolder()
loadedfolder._limit = 5
self.assertEquals( loadedfolder.getLimit(), 5 )
def testLimitReach(self):
""" """
loadedfolder = LoadedFolder()
loadedfolder.setObject('object1', Object())
loadedfolder._limit = 2
# A second one should fit in
self.failIf(loadedfolder.setObject('object2', Object()))
# But with 3 go on strike
self.assertRaises( FolderLimitExceededError,
loadedfolder.setObject,
'object3', Object() )
def test_suite():
loader = unittest.TestLoader()
return loader.loadTestsFromTestCase( Test )
if __name__=='__main__':
unittest.main()