Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Private Member Functions
CMFDynamicViewFTI.tests.test_fti.TestFTI Class Reference
Inheritance diagram for CMFDynamicViewFTI.tests.test_fti.TestFTI:
Inheritance graph
[legend]
Collaboration diagram for CMFDynamicViewFTI.tests.test_fti.TestFTI:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def test_doesImplementITypeInformation
def test_doesImplementIDynamicViewTypeInformation
def test_meta_type
def test_paranoid_subclass_test
def test_CreateDynFolder
def test_DynFolderDefaultView
def test_DynFolderCustomView
def test_DynFolderViewFromLayout
def test_DynFolderViewFromCallableLayout
def test_NoneLayoutReturnsDefaultView
def test_EmptyLayoutReturnsDefaultView
def test_InvalidLayoutRaisesTypeError
def test_EnforceLayoutAvailable
def test_UnavailableLayoutReturnsDefaultView
def test_CheckLayoutExists
def test_MissingLayoutReturnsDefaultView
def test_DynFolderDefaultPage
def test_DynFolderDefaultPageFromAttribute
def test_DynFolderDefaultPageFromCallable
def test_NoneDefaultPageReturnsNone
def test_EmptyDefaultPageReturnsNone
def test_InvalidDefaultPageRaisesTypeError
def test_CheckDefaultPageExists
def test_MissingDefaultPageReturnsNone
def test_NonFolderishObjectReturnsNone

Public Attributes

 types
 fti

Private Member Functions

def _makeOne

Detailed Description

Definition at line 20 of file test_fti.py.


Member Function Documentation

Definition at line 26 of file test_fti.py.

00026 
00027     def _makeOne(self):
00028         # Create and return a DynFolder
00029         self.folder.invokeFactory('DynFolder', id='dynfolder')
00030         return self.folder.dynfolder

Definition at line 22 of file test_fti.py.

00022 
00023     def afterSetUp(self):
00024         self.types = getToolByName(self.portal, 'portal_types')
00025         self.fti = self.types['DynFolder']

Definition at line 160 of file test_fti.py.

00160 
00161     def test_CheckDefaultPageExists(self):
00162         dynfolder = self._makeOne()
00163         dynfolder.manage_addDTMLMethod('custom_page', file='')
00164         dynfolder.default_page = 'custom_page'
00165         info = self.types.getTypeInfo(dynfolder)
00166         self.assertEqual(info.getDefaultPage(dynfolder, check_exists=True), 'custom_page')

Definition at line 112 of file test_fti.py.

00112 
00113     def test_CheckLayoutExists(self):
00114         dynfolder = self._makeOne()
00115         dynfolder.manage_addDTMLMethod('custom_view', file='')
00116         dynfolder.layout = 'custom_view'
00117         info = self.types.getTypeInfo(dynfolder)
00118         self.assertEqual(info.getViewMethod(dynfolder, check_exists=True), 'custom_view')

Definition at line 50 of file test_fti.py.

00050 
00051     def test_CreateDynFolder(self):
00052         dynfolder = self._makeOne()
00053         self.assertEqual(dynfolder.getPortalTypeName(), 'DynFolder')
00054         info = self.types.getTypeInfo(dynfolder)
00055         self.assertEqual(info.getId(), 'DynFolder')
00056         self.assertEqual(info.Title(), 'DynFolder')
00057         self.assertEqual(info.getDefaultViewMethod(dynfolder), 'index_html')
00058         self.assertEqual(info.getAvailableViewMethods(dynfolder), ('index_html', 'custom_view', 'zope3_view'))

Definition at line 39 of file test_fti.py.

00039 
00040     def test_doesImplementIDynamicViewTypeInformation(self):
00041         iface = IDynamicViewTypeInformation
00042         self.failUnless(iface.isImplementedBy(self.fti))
00043         self.failUnless(verifyObject(iface, self.fti))

Definition at line 31 of file test_fti.py.

00031 
00032     def test_doesImplementITypeInformation(self):
00033         iface = ITypeInformation
00034         if issubclass(iface, Interface):
00035             self.failUnless(iface.providedBy(self.fti))
00036         else:
00037             self.failUnless(iface.isImplementedBy(self.fti))
00038             self.failUnless(verifyObject(iface, self.fti))

Definition at line 64 of file test_fti.py.

00064 
00065     def test_DynFolderCustomView(self):
00066         dynfolder = self._makeOne()
00067         self.types.DynFolder.manage_changeProperties(default_view='custom_view')
00068         info = self.types.getTypeInfo(dynfolder)
00069         self.assertEqual(info.getViewMethod(dynfolder), 'custom_view')

Definition at line 125 of file test_fti.py.

00125 
00126     def test_DynFolderDefaultPage(self):
00127         dynfolder = self._makeOne()
00128         info = self.types.getTypeInfo(dynfolder)
00129         self.assertEqual(info.getDefaultPage(dynfolder), None)

Definition at line 130 of file test_fti.py.

00130 
00131     def test_DynFolderDefaultPageFromAttribute(self):
00132         dynfolder = self._makeOne()
00133         dynfolder.default_page = 'custom_page'
00134         info = self.types.getTypeInfo(dynfolder)
00135         self.assertEqual(info.getDefaultPage(dynfolder), 'custom_page')

Definition at line 136 of file test_fti.py.

00136 
00137     def test_DynFolderDefaultPageFromCallable(self):
00138         dynfolder = self._makeOne()
00139         dynfolder.default_page = lambda: 'custom_page'
00140         info = self.types.getTypeInfo(dynfolder)
00141         self.assertEqual(info.getDefaultPage(dynfolder), 'custom_page')

Definition at line 59 of file test_fti.py.

00059 
00060     def test_DynFolderDefaultView(self):
00061         dynfolder = self._makeOne()
00062         info = self.types.getTypeInfo(dynfolder)
00063         self.assertEqual(info.getViewMethod(dynfolder), 'index_html')

Definition at line 76 of file test_fti.py.

00076 
00077     def test_DynFolderViewFromCallableLayout(self):
00078         dynfolder = self._makeOne()
00079         dynfolder.layout = lambda: 'custom_view'
00080         info = self.types.getTypeInfo(dynfolder)
00081         self.assertEqual(info.getViewMethod(dynfolder), 'custom_view')

Definition at line 70 of file test_fti.py.

00070 
00071     def test_DynFolderViewFromLayout(self):
00072         dynfolder = self._makeOne()
00073         dynfolder.layout = 'custom_view'
00074         info = self.types.getTypeInfo(dynfolder)
00075         self.assertEqual(info.getViewMethod(dynfolder), 'custom_view')

Definition at line 148 of file test_fti.py.

00148 
00149     def test_EmptyDefaultPageReturnsNone(self):
00150         dynfolder = self._makeOne()
00151         dynfolder.default_page = ''
00152         info = self.types.getTypeInfo(dynfolder)
00153         self.assertEqual(info.getDefaultPage(dynfolder), None)

Definition at line 88 of file test_fti.py.

00088 
00089     def test_EmptyLayoutReturnsDefaultView(self):
00090         dynfolder = self._makeOne()
00091         dynfolder.layout = ''
00092         info = self.types.getTypeInfo(dynfolder)
00093         self.assertEqual(info.getViewMethod(dynfolder), 'index_html')

Definition at line 100 of file test_fti.py.

00100 
00101     def test_EnforceLayoutAvailable(self):
00102         dynfolder = self._makeOne()
00103         dynfolder.layout = 'custom_view'
00104         info = self.types.getTypeInfo(dynfolder)
00105         self.assertEqual(info.getViewMethod(dynfolder, enforce_available=True), 'custom_view')

Definition at line 154 of file test_fti.py.

00154 
00155     def test_InvalidDefaultPageRaisesTypeError(self):
00156         dynfolder = self._makeOne()
00157         dynfolder.default_page = object()
00158         info = self.types.getTypeInfo(dynfolder)
00159         self.assertRaises(TypeError, info.getDefaultPage, dynfolder)

Definition at line 94 of file test_fti.py.

00094 
00095     def test_InvalidLayoutRaisesTypeError(self):
00096         dynfolder = self._makeOne()
00097         dynfolder.layout = object()
00098         info = self.types.getTypeInfo(dynfolder)
00099         self.assertRaises(TypeError, info.getViewMethod, dynfolder)

Definition at line 44 of file test_fti.py.

00044 
00045     def test_meta_type(self):
00046         self.failUnlessEqual(self.fti.meta_type, fti_meta_type)

Definition at line 167 of file test_fti.py.

00167 
00168     def test_MissingDefaultPageReturnsNone(self):
00169         dynfolder = self._makeOne()
00170         dynfolder.default_page = 'bad_page'
00171         info = self.types.getTypeInfo(dynfolder)
00172         self.assertEqual(info.getDefaultPage(dynfolder, check_exists=True), None)

Definition at line 119 of file test_fti.py.

00119 
00120     def test_MissingLayoutReturnsDefaultView(self):
00121         dynfolder = self._makeOne()
00122         dynfolder.layout = 'bad_view'
00123         info = self.types.getTypeInfo(dynfolder)
00124         self.assertEqual(info.getViewMethod(dynfolder, check_exists=True), 'index_html')

Definition at line 142 of file test_fti.py.

00142 
00143     def test_NoneDefaultPageReturnsNone(self):
00144         dynfolder = self._makeOne()
00145         dynfolder.default_page = None
00146         info = self.types.getTypeInfo(dynfolder)
00147         self.assertEqual(info.getDefaultPage(dynfolder), None)

Definition at line 82 of file test_fti.py.

00082 
00083     def test_NoneLayoutReturnsDefaultView(self):
00084         dynfolder = self._makeOne()
00085         dynfolder.layout = None
00086         info = self.types.getTypeInfo(dynfolder)
00087         self.assertEqual(info.getViewMethod(dynfolder), 'index_html')

Definition at line 173 of file test_fti.py.

00173 
00174     def test_NonFolderishObjectReturnsNone(self):
00175         dynfolder = self._makeOne()
00176         dynfolder.isPrincipiaFolderish = 0
00177         dynfolder.default_page = 'custom_page'
00178         info = self.types.getTypeInfo(dynfolder)
00179         self.assertEqual(info.getDefaultPage(dynfolder), None)
00180 

Definition at line 47 of file test_fti.py.

00047 
00048     def test_paranoid_subclass_test(self):
00049         self.failUnless(isinstance(self.fti, DynamicViewTypeInformation))

Definition at line 106 of file test_fti.py.

00106 
00107     def test_UnavailableLayoutReturnsDefaultView(self):
00108         dynfolder = self._makeOne()
00109         dynfolder.layout = 'bad_view'
00110         info = self.types.getTypeInfo(dynfolder)
00111         self.assertEqual(info.getViewMethod(dynfolder, enforce_available=True), 'index_html')


Member Data Documentation

Definition at line 24 of file test_fti.py.

Definition at line 23 of file test_fti.py.


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