Back to index

plone3  3.1.7
Public Member Functions | Private Member Functions
CMFDefault.tests.test_MetadataTool.TestMetadataElementPolicy Class Reference

List of all members.

Public Member Functions

def test_empty_single_valued
def test_edit_single_valued
def test_empty_multi_valued
def test_edit_multi_valued

Private Member Functions

def _getTargetClass
def _makeOne

Detailed Description

Definition at line 24 of file test_MetadataTool.py.


Member Function Documentation

Definition at line 26 of file test_MetadataTool.py.

00026 
00027     def _getTargetClass( self ):
00028         from Products.CMFDefault.MetadataTool import MetadataElementPolicy
00029         return MetadataElementPolicy

def CMFDefault.tests.test_MetadataTool.TestMetadataElementPolicy._makeOne (   self,
  args,
  kw 
) [private]

Definition at line 30 of file test_MetadataTool.py.

00030 
00031     def _makeOne( self, *args, **kw ):
00032         return self._getTargetClass()( *args, **kw )

Here is the call graph for this function:

Definition at line 61 of file test_MetadataTool.py.

00061 
00062     def test_edit_multi_valued( self ):
00063         mv_policy = self._makeOne( 1 )
00064         mv_policy.edit( 1, 1, 'xxx', 1, ( 'xxx', 'yyy' ) )
00065         self.failUnless( mv_policy.isMultiValued() )
00066         self.failUnless( mv_policy.isRequired() )
00067         self.failUnless( mv_policy.supplyDefault() )
00068         self.assertEqual( mv_policy.defaultValue(), 'xxx' )
00069         self.failUnless( mv_policy.enforceVocabulary() )
00070         self.assertEqual( len( mv_policy.allowedVocabulary() ), 2 )
00071         self.failUnless( 'xxx' in mv_policy.allowedVocabulary() )
00072         self.failUnless( 'yyy' in mv_policy.allowedVocabulary() )
00073 

Definition at line 42 of file test_MetadataTool.py.

00042 
00043     def test_edit_single_valued( self ):
00044         sv_policy = self._makeOne( 0 )
00045         sv_policy.edit( 1, 1, 'xxx', 0, '' )
00046         self.failIf( sv_policy.isMultiValued() )
00047         self.failUnless( sv_policy.isRequired() )
00048         self.failUnless( sv_policy.supplyDefault() )
00049         self.assertEquals( sv_policy.defaultValue(), 'xxx' )
00050         self.failIf( sv_policy.enforceVocabulary() )
00051         self.failIf( sv_policy.allowedVocabulary() )

Definition at line 52 of file test_MetadataTool.py.

00052 
00053     def test_empty_multi_valued( self ):
00054         mv_policy = self._makeOne( 1 )
00055         self.failUnless( mv_policy.isMultiValued() )
00056         self.failIf( mv_policy.isRequired() )
00057         self.failIf( mv_policy.supplyDefault() )
00058         self.failIf( mv_policy.defaultValue() )
00059         self.failIf( mv_policy.enforceVocabulary() )
00060         self.failIf( mv_policy.allowedVocabulary() )

Definition at line 33 of file test_MetadataTool.py.

00033 
00034     def test_empty_single_valued( self ):
00035         sv_policy = self._makeOne( 0 )
00036         self.failIf( sv_policy.isMultiValued() )
00037         self.failIf( sv_policy.isRequired() )
00038         self.failIf( sv_policy.supplyDefault() )
00039         self.failIf( sv_policy.defaultValue() )
00040         self.failIf( sv_policy.enforceVocabulary() )
00041         self.failIf( sv_policy.allowedVocabulary() )


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