Back to index

plone3  3.1.7
Public Member Functions | Private Member Functions
CMFCore.tests.test_FSPythonScript.FSPythonScriptCustomizationTests Class Reference
Inheritance diagram for CMFCore.tests.test_FSPythonScript.FSPythonScriptCustomizationTests:
Inheritance graph
[legend]
Collaboration diagram for CMFCore.tests.test_FSPythonScript.FSPythonScriptCustomizationTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def tearDown
def test_customize
def test_customize_alternate_root
def test_customize_fspath_as_dot
def test_customize_manual_clone
def test_customize_caching
def test_customize_proxyroles
def test_customization_permissions

Private Member Functions

def _makeSkins

Detailed Description

Definition at line 86 of file test_FSPythonScript.py.


Member Function Documentation

Definition at line 96 of file test_FSPythonScript.py.

00096 
00097     def _makeSkins(self):
00098 
00099         root = self.root
00100         root._setObject( 'portal_skins', Folder( 'portal_skins' ) )
00101         tool = self.root.portal_skins
00102 
00103         tool._setObject( 'custom', Folder( 'custom' ) )
00104         custom = tool.custom
00105 
00106         tool._setObject( 'fsdir', Folder( 'fsdir' ) )
00107         fsdir = tool.fsdir
00108 
00109         fsdir._setObject( 'test6'
00110                         , self._makeOne( 'test6', 'test6.py' ) )
00111 
00112         fsPS = fsdir.test6
00113 
00114         return root, tool, custom, fsdir, fsPS

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 88 of file test_FSPythonScript.py.

00088 
00089     def setUp( self ):
00090         FSPSMaker.setUp(self)
00091         SecurityTest.setUp( self )

Definition at line 92 of file test_FSPythonScript.py.

00092 
00093     def tearDown(self):
00094         SecurityTest.tearDown(self)
00095         FSPSMaker.tearDown(self)

Definition at line 191 of file test_FSPythonScript.py.

00191 
00192     def test_customization_permissions(self):
00193         # Test to ensure that permission settings survive customizing
00194         root, tool, custom, fsdir, fsPS = self._makeSkins()
00195         perm = 'View management screens'
00196 
00197         # First, set a permission to an odd role and verify
00198         fsPS.manage_permission( perm
00199                               , roles=('Anonymous',)
00200                               , acquire=0
00201                               )
00202         rop = fsPS.rolesOfPermission(perm)
00203         for rop_info in rop:
00204             if rop_info['name'] == 'Anonymous':
00205                 self.failIf(rop_info['selected'] == '')
00206             else:
00207                 self.failUnless(rop_info['selected'] == '')
00208 
00209         # Now customize and verify again
00210         fsPS.manage_doCustomize(folder_path='custom')
00211         custom_ps = custom.test6
00212         rop = custom_ps.rolesOfPermission(perm)
00213         for rop_info in rop:
00214             if rop_info['name'] == 'Anonymous':
00215                 self.failIf(rop_info['selected'] == '')
00216             else:
00217                 self.failUnless(rop_info['selected'] == '')

Here is the call graph for this function:

Definition at line 115 of file test_FSPythonScript.py.

00115 
00116     def test_customize( self ):
00117 
00118         from Products.CMFCore.FSPythonScript import CustomizedPythonScript
00119 
00120         root, tool, custom, fsdir, fsPS = self._makeSkins()
00121 
00122         fsPS.manage_doCustomize( folder_path='custom' )
00123 
00124         self.assertEqual( len( custom.objectIds() ), 1 )
00125         self.failUnless( 'test6' in custom.objectIds() )  
00126 
00127         test6 = custom._getOb('test6')
00128 
00129         self.failUnless(isinstance(test6, CustomizedPythonScript))
00130         self.assertEqual(test6.original_source, fsPS.read())

Here is the call graph for this function:

Definition at line 131 of file test_FSPythonScript.py.

00131 
00132     def test_customize_alternate_root( self ):
00133 
00134         root, tool, custom, fsdir, fsPS = self._makeSkins()
00135         root.other = Folder('other')
00136 
00137         fsPS.manage_doCustomize( folder_path='other', root=root )
00138 
00139         self.failIf( 'test6' in custom.objectIds() )  
00140         self.failUnless( 'test6' in root.other.objectIds() )  

Here is the call graph for this function:

Definition at line 160 of file test_FSPythonScript.py.

00160 
00161     def test_customize_caching(self):
00162         # Test to ensure that cache manager associations survive customizing
00163         root, tool, custom, fsdir, fsPS = self._makeSkins()
00164 
00165         cache_id = 'gofast'
00166         RAMCacheManager.manage_addRAMCacheManager( root
00167                                                  , cache_id
00168                                                  , REQUEST=None
00169                                                  )
00170         fsPS.ZCacheable_setManagerId(cache_id, REQUEST=None)
00171 
00172         self.assertEqual(fsPS.ZCacheable_getManagerId(), cache_id)
00173 
00174         fsPS.manage_doCustomize(folder_path='custom')
00175         custom_ps = custom.test6
00176 
00177         self.assertEqual(custom_ps.ZCacheable_getManagerId(), cache_id)

Here is the call graph for this function:

Definition at line 141 of file test_FSPythonScript.py.

00141 
00142     def test_customize_fspath_as_dot( self ):
00143 
00144         root, tool, custom, fsdir, fsPS = self._makeSkins()
00145 
00146         fsPS.manage_doCustomize( folder_path='.' )
00147 
00148         self.failIf( 'test6' in custom.objectIds() )  
00149         self.failUnless( 'test6' in root.portal_skins.objectIds() )  

Here is the call graph for this function:

Definition at line 150 of file test_FSPythonScript.py.

00150 
00151     def test_customize_manual_clone( self ):
00152 
00153         root, tool, custom, fsdir, fsPS = self._makeSkins()
00154         clone = Folder('test6')
00155 
00156         fsPS.manage_doCustomize( folder_path='custom', obj=clone )
00157 
00158         self.failUnless( 'test6' in custom.objectIds() )  
00159         self.failUnless( aq_base(custom._getOb('test6')) is clone )  

Here is the call graph for this function:

Definition at line 178 of file test_FSPythonScript.py.

00178 
00179     def test_customize_proxyroles(self):
00180         # Test to ensure that proxy roles survive customizing
00181         root, tool, custom, fsdir, fsPS = self._makeSkins()
00182 
00183         fsPS._proxy_roles = ('Manager', 'Anonymous')
00184         self.failUnless(fsPS.manage_haveProxy('Anonymous'))
00185         self.failUnless(fsPS.manage_haveProxy('Manager'))
00186 
00187         fsPS.manage_doCustomize(folder_path='custom')
00188         custom_ps = custom.test6
00189         self.failUnless(custom_ps.manage_haveProxy('Anonymous'))
00190         self.failUnless(custom_ps.manage_haveProxy('Manager'))

Here is the call graph for this function:


The documentation for this class was generated from the following file: