Back to index

plone3  3.1.7
test_UndoTool.py
Go to the documentation of this file.
00001 ##############################################################################
00002 #
00003 # Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
00004 #
00005 # This software is subject to the provisions of the Zope Public License,
00006 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
00007 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
00008 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00009 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
00010 # FOR A PARTICULAR PURPOSE.
00011 #
00012 ##############################################################################
00013 """ Unit tests for UndoTool module.
00014 
00015 $Id: test_UndoTool.py 77379 2007-07-03 19:55:29Z yuppie $
00016 """
00017 
00018 import unittest
00019 import Testing
00020 
00021 
00022 class DummyFolder(object):
00023 
00024     def undoable_transactions(self, first_transaction=None,
00025                               last_transaction=None,
00026                               PrincipiaUndoBatchSize=None):
00027         return ()
00028 
00029 
00030 class UndoToolTests(unittest.TestCase):
00031 
00032     def _getTargetClass(self):
00033         from Products.CMFCore.UndoTool import UndoTool
00034 
00035         return UndoTool
00036 
00037     def _makeOne(self, *args, **kw):
00038         return self._getTargetClass()(*args, **kw)
00039 
00040     def test_z2interfaces(self):
00041         from Interface.Verify import verifyClass
00042         from Products.CMFCore.interfaces.portal_undo \
00043                 import portal_undo as IUndoTool
00044 
00045         verifyClass(IUndoTool, self._getTargetClass())
00046 
00047     def test_z3interfaces(self):
00048         from zope.interface.verify import verifyClass
00049         from Products.CMFCore.interfaces import IUndoTool
00050 
00051         verifyClass(IUndoTool, self._getTargetClass())
00052 
00053     def test_listUndoableTransactionsFor(self):
00054         udtool = self._makeOne()
00055         obj = DummyFolder()
00056         transactions = udtool.listUndoableTransactionsFor(obj)
00057         self.assertEqual(transactions, ())
00058 
00059 
00060 def test_suite():
00061     return unittest.TestSuite((
00062         unittest.makeSuite(UndoToolTests),
00063         ))
00064 
00065 if __name__ == '__main__':
00066     unittest.main(defaultTest='test_suite')