vendor/CMF/1.6.3/CMFCore

diff 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 diff
     1.1 new file mode 100644
     1.2 --- /dev/null
     1.3 +++ b/tests/test_FSPropertiesObject.py
     1.4 @@ -0,0 +1,63 @@
     1.5 +from unittest import TestSuite, makeSuite, main
     1.6 +import Testing
     1.7 +try:
     1.8 +    import Zope2
     1.9 +except ImportError: # BBB: for Zope 2.7
    1.10 +    import Zope as Zope2
    1.11 +Zope2.startup()
    1.12 +
    1.13 +from os.path import join
    1.14 +
    1.15 +from OFS.Folder import Folder
    1.16 +
    1.17 +from Products.CMFCore.FSPropertiesObject import FSPropertiesObject
    1.18 +from Products.CMFCore.tests.base.testcase import FSDVTest
    1.19 +from Products.CMFCore.tests.base.testcase import SecurityTest
    1.20 +
    1.21 +
    1.22 +class FSPOMaker(FSDVTest):
    1.23 +
    1.24 +    def _makeOne( self, id, filename ):
    1.25 +        path = join(self.skin_path_name, filename)
    1.26 +        return FSPropertiesObject( id, path ) 
    1.27 +
    1.28 +
    1.29 +class FSPropertiesObjectCustomizationTests(SecurityTest, FSPOMaker):
    1.30 +
    1.31 +    def setUp( self ):
    1.32 +        FSPOMaker.setUp(self)
    1.33 +        SecurityTest.setUp( self )
    1.34 +
    1.35 +        self.root._setObject( 'portal_skins', Folder( 'portal_skins' ) )
    1.36 +        self.skins = self.root.portal_skins
    1.37 +
    1.38 +        self.skins._setObject( 'custom', Folder( 'custom' ) )
    1.39 +        self.custom = self.skins.custom
    1.40 +
    1.41 +        self.skins._setObject( 'fsdir', Folder( 'fsdir' ) )
    1.42 +        self.fsdir = self.skins.fsdir
    1.43 +
    1.44 +        self.fsdir._setObject( 'test_props'
    1.45 +                             , self._makeOne( 'test_props', 'test_props.props' ) )
    1.46 +
    1.47 +        self.fsPO = self.fsdir.test_props
    1.48 +
    1.49 +    def tearDown(self):
    1.50 +        SecurityTest.tearDown(self)
    1.51 +        FSPOMaker.tearDown(self)
    1.52 +
    1.53 +    def test_customize( self ):
    1.54 +
    1.55 +        self.fsPO.manage_doCustomize( folder_path='custom' )
    1.56 +
    1.57 +        self.assertEqual( len( self.custom.objectIds() ), 1 )
    1.58 +        self.failUnless( 'test_props' in self.custom.objectIds() )  
    1.59 +
    1.60 +
    1.61 +def test_suite():
    1.62 +    return TestSuite((
    1.63 +        makeSuite(FSPropertiesObjectCustomizationTests),
    1.64 +        ))
    1.65 +
    1.66 +if __name__ == '__main__':
    1.67 +    main(defaultTest='test_suite')