Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Static Private Attributes
CMFCore.tests.test_PortalFolder.PortalFolderFactoryTests Class Reference
Inheritance diagram for CMFCore.tests.test_PortalFolder.PortalFolderFactoryTests:
Inheritance graph
[legend]
Collaboration diagram for CMFCore.tests.test_PortalFolder.PortalFolderFactoryTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def test_invokeFactory
def test_invokeFactory_disallowed_type

Public Attributes

 site
 f

Static Public Attributes

 layer = TraversingEventZCMLLayer

Private Member Functions

def _getTargetObject

Static Private Attributes

string _PORTAL_TYPE = 'Test Folder'

Detailed Description

Definition at line 58 of file test_PortalFolder.py.


Member Function Documentation

Definition at line 63 of file test_PortalFolder.py.

00063 
00064     def _getTargetObject(self):
00065         from Products.CMFCore.PortalFolder import PortalFolderFactory
00066 
00067         return PortalFolderFactory

Here is the caller graph for this function:

Definition at line 68 of file test_PortalFolder.py.

00068 
00069     def setUp(self):
00070         from Products.CMFCore.PortalFolder import PortalFolder
00071 
00072         SecurityTest.setUp(self)
00073         sm = getSiteManager()
00074         sm.registerUtility(self._getTargetObject(), IFactory, 'cmf.folder')
00075         self.site = DummySite('site').__of__(self.root)
00076         acl_users = self.site._setObject('acl_users', DummyUserFolder())
00077         newSecurityManager(None, acl_users.all_powerful_Oz)
00078 
00079         ttool = self.site._setObject('portal_types', TypesTool())
00080         ttool._setObject(self._PORTAL_TYPE,
00081                          FTI(id=self._PORTAL_TYPE,
00082                              title='Folder or Directory',
00083                              meta_type=PortalFolder.meta_type,
00084                              factory='cmf.folder',
00085                              filter_content_types=0))
00086         ttool._setObject('Dummy Content', FTI(**FTIDATA_DUMMY[0].copy()))
00087 
00088         self.f = self.site._setObject('container', PortalFolder('container'))
00089         self.f._setPortalTypeName(self._PORTAL_TYPE)

Here is the call graph for this function:

Definition at line 90 of file test_PortalFolder.py.

00090 
00091     def test_invokeFactory(self):
00092         f = self.f
00093         self.failIf( 'foo' in f.objectIds() )
00094 
00095         f.manage_addProduct = {'FooProduct': DummyFactoryDispatcher(f)}
00096         f.invokeFactory( type_name='Dummy Content', id='foo' )
00097 
00098         self.failUnless( 'foo' in f.objectIds() )
00099         foo = f.foo
00100         self.assertEqual( foo.getId(), 'foo' )
00101         self.assertEqual( foo.getPortalTypeName(), 'Dummy Content' )
00102         self.assertEqual( foo.Type(), 'Dummy Content Title' )

Definition at line 103 of file test_PortalFolder.py.

00103 
00104     def test_invokeFactory_disallowed_type(self):
00105         f = self.f
00106         ftype = getattr(self.site.portal_types, self._PORTAL_TYPE)
00107         ftype.filter_content_types = 1
00108         self.assertRaises(ValueError,
00109                           f.invokeFactory, self._PORTAL_TYPE, 'sub')
00110 
00111         ftype.allowed_content_types = (self._PORTAL_TYPE,)
00112         f.invokeFactory(self._PORTAL_TYPE, id='sub')
00113         self.failUnless('sub' in f.objectIds())
00114         self.assertRaises(ValueError, f.invokeFactory, 'Dummy Content', 'foo')
00115 


Member Data Documentation

Definition at line 61 of file test_PortalFolder.py.

Definition at line 87 of file test_PortalFolder.py.

Definition at line 60 of file test_PortalFolder.py.

Definition at line 74 of file test_PortalFolder.py.


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