vendor/CMF/1.6.3/CMFCore

view tests/test_FSPropertiesObject.py @ 0:587011552858

import CMF 1.6.3
author bdelbosc
date Mon, 23 Apr 2007 13:58:01 +0000
parents
children
line source
1 from unittest import TestSuite, makeSuite, main
2 import Testing
3 try:
4 import Zope2
5 except ImportError: # BBB: for Zope 2.7
6 import Zope as Zope2
7 Zope2.startup()
9 from os.path import join
11 from OFS.Folder import Folder
13 from Products.CMFCore.FSPropertiesObject import FSPropertiesObject
14 from Products.CMFCore.tests.base.testcase import FSDVTest
15 from Products.CMFCore.tests.base.testcase import SecurityTest
18 class FSPOMaker(FSDVTest):
20 def _makeOne( self, id, filename ):
21 path = join(self.skin_path_name, filename)
22 return FSPropertiesObject( id, path )
25 class FSPropertiesObjectCustomizationTests(SecurityTest, FSPOMaker):
27 def setUp( self ):
28 FSPOMaker.setUp(self)
29 SecurityTest.setUp( self )
31 self.root._setObject( 'portal_skins', Folder( 'portal_skins' ) )
32 self.skins = self.root.portal_skins
34 self.skins._setObject( 'custom', Folder( 'custom' ) )
35 self.custom = self.skins.custom
37 self.skins._setObject( 'fsdir', Folder( 'fsdir' ) )
38 self.fsdir = self.skins.fsdir
40 self.fsdir._setObject( 'test_props'
41 , self._makeOne( 'test_props', 'test_props.props' ) )
43 self.fsPO = self.fsdir.test_props
45 def tearDown(self):
46 SecurityTest.tearDown(self)
47 FSPOMaker.tearDown(self)
49 def test_customize( self ):
51 self.fsPO.manage_doCustomize( folder_path='custom' )
53 self.assertEqual( len( self.custom.objectIds() ), 1 )
54 self.failUnless( 'test_props' in self.custom.objectIds() )
57 def test_suite():
58 return TestSuite((
59 makeSuite(FSPropertiesObjectCustomizationTests),
60 ))
62 if __name__ == '__main__':
63 main(defaultTest='test_suite')