Back to index

plone3  3.1.7
test_migrations.py
Go to the documentation of this file.
00001 
00002 from Testing import ZopeTestCase # side effect import. leave it here.
00003 from Products.ATContentTypes.tests import atcttestcase
00004 
00005 from Products.ATContentTypes.config import TOOLNAME
00006 from Products.ATContentTypes.migration.v1_2 import upgradeATCTTool
00007 from Products.CMFCore.utils import getToolByName
00008 
00009 
00010 class TestMigrations_v1_2(atcttestcase.ATCTSiteTestCase):
00011 
00012     def afterSetUp(self):
00013         self.tool = getToolByName(self.portal, TOOLNAME)
00014 
00015     def testUpgradeATCTTool(self):
00016         self.assertEquals(self.tool.getProperty('album_batch_size'), 30)
00017         self.tool._setPropValue('album_batch_size', 99)
00018         self.tool._setPropValue('_version', '1.1.x (svn/testing)')
00019         upgradeATCTTool(self.portal, [])
00020         self.assertEquals(self.tool.getProperty('album_batch_size'), 99)
00021 
00022     def testUpgradeATCTToolTwice(self):
00023         self.assertEquals(self.tool.getProperty('album_batch_size'), 30)
00024         self.tool._setPropValue('album_batch_size', 99)
00025         self.tool._setPropValue('_version', '1.1.x (svn/testing)')
00026         upgradeATCTTool(self.portal, [])
00027         upgradeATCTTool(self.portal, [])
00028         self.assertEquals(self.tool.getProperty('album_batch_size'), 99)
00029 
00030 
00031 def test_suite():
00032     from unittest import TestSuite, makeSuite
00033     suite = TestSuite()
00034     suite.addTest(makeSuite(TestMigrations_v1_2))
00035     return suite