Back to index

plone3  3.1.7
testDateIndexRanges.py
Go to the documentation of this file.
00001 #
00002 # DateIndex range tests
00003 #
00004 
00005 from Products.CMFPlone.tests import PloneTestCase
00006 
00007 from DateTime import DateTime
00008 
00009 
00010 class TestDateIndexRanges(PloneTestCase.PloneTestCase):
00011 
00012     def afterSetUp(self):
00013         self.catalog = self.portal.portal_catalog
00014         self.folder.invokeFactory('Document', 'doc1', title='Foo')
00015 
00016     def testLoWatermark(self):
00017         self.folder.doc1.setExpirationDate(DateTime(-2113, 0))
00018         self.folder.doc1.reindexObject()
00019 
00020     def testHiWatermark(self):
00021         self.folder.doc1.setExpirationDate(DateTime(4008, 0))
00022         self.folder.doc1.reindexObject()
00023 
00024     def testUnderflow(self):
00025         self.folder.doc1.setExpirationDate(DateTime(-2114, 0))
00026         # No OverflowError due to monkey patch
00027         #self.assertRaises(OverflowError, self.folder.doc1.reindexObject)
00028         self.folder.doc1.reindexObject()
00029 
00030     def testOverflow(self):
00031         self.folder.doc1.setExpirationDate(DateTime(4009, 0))
00032         # No OverflowError due to monkey patch
00033         #self.assertRaises(OverflowError, self.folder.doc1.reindexObject)
00034         self.folder.doc1.reindexObject()
00035 
00036     def testDRIUnderflow(self):
00037         self.folder.doc1.setEffectiveDate(DateTime(-2114, 0))
00038         # No OverflowError due to monkey patch
00039         #self.assertRaises(OverflowError, self.folder.doc1.reindexObject)
00040         self.folder.doc1.reindexObject()
00041 
00042     def testDRIOverflow(self):
00043         self.folder.doc1.setEffectiveDate(DateTime(4009, 0))
00044         # No OverflowError due to monkey patch
00045         #self.assertRaises(OverflowError, self.folder.doc1.reindexObject)
00046         self.folder.doc1.reindexObject()
00047 
00048 
00049 def test_suite():
00050     from unittest import TestSuite, makeSuite
00051     suite = TestSuite()
00052     suite.addTest(makeSuite(TestDateIndexRanges))
00053     return suite