Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Private Member Functions
GenericSetup.tests.test_registry.ToolsetRegistryTests Class Reference
Inheritance diagram for GenericSetup.tests.test_registry.ToolsetRegistryTests:
Inheritance graph
[legend]
Collaboration diagram for GenericSetup.tests.test_registry.ToolsetRegistryTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_empty
def test_addForbiddenTool_multiple
def test_addForbiddenTool_duplicate
def test_addForbiddenTool_but_required
def test_addRequiredTool_multiple
def test_addRequiredTool_duplicate
def test_addRequiredTool_but_forbidden
def test_generateXML_empty
def test_generateXML_normal
def test_parseXML_empty
def test_parseXML_normal
def test_parseXML_confused

Static Public Attributes

 layer = ExportImportZCMLLayer

Private Member Functions

def _getTargetClass
def _initSite

Detailed Description

Definition at line 809 of file test_registry.py.


Member Function Documentation

Definition at line 813 of file test_registry.py.

00813 
00814     def _getTargetClass( self ):
00815 
00816         from Products.GenericSetup.registry import ToolsetRegistry
00817         return ToolsetRegistry

Definition at line 818 of file test_registry.py.

00818 
00819     def _initSite( self ):
00820 
00821         self.app.site = Folder(id='site')
00822         site = self.app.site
00823 
00824         return site

Definition at line 863 of file test_registry.py.

00863 
00864     def test_addForbiddenTool_but_required( self ):
00865 
00866         site = self._initSite()
00867         configurator = self._makeOne().__of__( site )
00868 
00869         configurator.addRequiredTool( 'required', 'some.dotted.name' )
00870 
00871         self.assertRaises( ValueError
00872                          , configurator.addForbiddenTool, 'required' )

Definition at line 853 of file test_registry.py.

00853 
00854     def test_addForbiddenTool_duplicate( self ):
00855 
00856         site = self._initSite()
00857         configurator = self._makeOne().__of__( site )
00858 
00859         configurator.addForbiddenTool( 'once' )
00860         configurator.addForbiddenTool( 'once' )
00861 
00862         self.assertEqual( len( configurator.listForbiddenTools() ), 1 )

Definition at line 837 of file test_registry.py.

00837 
00838     def test_addForbiddenTool_multiple( self ):
00839 
00840         VERBOTTEN = ( 'foo', 'bar', 'bam' )
00841 
00842         site = self._initSite()
00843         configurator = self._makeOne().__of__( site )
00844 
00845         for verbotten in VERBOTTEN:
00846             configurator.addForbiddenTool( verbotten )
00847 
00848         self.assertEqual( len( configurator.listForbiddenTools() )
00849                         , len( VERBOTTEN ) )
00850 
00851         for verbotten in configurator.listForbiddenTools():
00852             self.failUnless( verbotten in VERBOTTEN )

Definition at line 912 of file test_registry.py.

00912 
00913     def test_addRequiredTool_but_forbidden( self ):
00914 
00915         site = self._initSite()
00916         configurator = self._makeOne().__of__( site )
00917 
00918         configurator.addForbiddenTool( 'forbidden' )
00919 
00920         self.assertRaises( ValueError
00921                          , configurator.addRequiredTool
00922                          , 'forbidden'
00923                          , 'a.name'
00924                          )

Definition at line 900 of file test_registry.py.

00900 
00901     def test_addRequiredTool_duplicate( self ):
00902 
00903         site = self._initSite()
00904         configurator = self._makeOne().__of__( site )
00905 
00906         configurator.addRequiredTool( 'required', 'some.dotted.name' )
00907         configurator.addRequiredTool( 'required', 'another.name' )
00908 
00909         info = configurator.getRequiredToolInfo( 'required' )
00910         self.assertEqual( info[ 'id' ], 'required' )
00911         self.assertEqual( info[ 'class' ], 'another.name' )

Definition at line 873 of file test_registry.py.

00873 
00874     def test_addRequiredTool_multiple( self ):
00875 
00876         REQUIRED = ( ( 'one', 'path.to.one' )
00877                    , ( 'two', 'path.to.two' )
00878                    , ( 'three', 'path.to.three' )
00879                    )
00880 
00881         site = self._initSite()
00882         configurator = self._makeOne().__of__( site )
00883 
00884         for tool_id, dotted_name in REQUIRED:
00885             configurator.addRequiredTool( tool_id, dotted_name )
00886 
00887         self.assertEqual( len( configurator.listRequiredTools() )
00888                         , len( REQUIRED ) )
00889 
00890         for id in [ x[0] for x in REQUIRED ]:
00891             self.failUnless( id in configurator.listRequiredTools() )
00892 
00893         self.assertEqual( len( configurator.listRequiredToolInfo() )
00894                         , len( REQUIRED ) )
00895 
00896         for tool_id, dotted_name in REQUIRED:
00897             info = configurator.getRequiredToolInfo( tool_id )
00898             self.assertEqual( info[ 'id' ], tool_id )
00899             self.assertEqual( info[ 'class' ], dotted_name )

Definition at line 825 of file test_registry.py.

00825 
00826     def test_empty( self ):
00827 
00828         site = self._initSite()
00829         configurator = self._makeOne().__of__( site )
00830 
00831         self.assertEqual( len( configurator.listForbiddenTools() ), 0 )
00832         self.assertEqual( len( configurator.listRequiredTools() ), 0 )
00833         self.assertEqual( len( configurator.listRequiredToolInfo() ), 0 )
00834 
00835         self.assertRaises( KeyError
00836                          , configurator.getRequiredToolInfo, 'nonesuch' )

Definition at line 925 of file test_registry.py.

00925 
00926     def test_generateXML_empty( self ):
00927 
00928         site = self._initSite()
00929         configurator = self._makeOne().__of__( site )
00930 
00931         self._compareDOM( configurator.generateXML(), _EMPTY_TOOLSET_XML )

Definition at line 932 of file test_registry.py.

00932 
00933     def test_generateXML_normal( self ):
00934 
00935         site = self._initSite()
00936         configurator = self._makeOne().__of__( site )
00937 
00938         configurator.addForbiddenTool( 'doomed' )
00939         configurator.addRequiredTool( 'mandatory', 'path.to.one' )
00940         configurator.addRequiredTool( 'obligatory', 'path.to.another' )
00941 
00942         configurator.parseXML( _NORMAL_TOOLSET_XML )

Definition at line 973 of file test_registry.py.

00973 
00974     def test_parseXML_confused( self ):
00975 
00976         site = self._initSite()
00977         configurator = self._makeOne().__of__( site )
00978 
00979         self.assertRaises( ValueError
00980                          , configurator.parseXML, _CONFUSED_TOOLSET_XML )
00981 

Definition at line 943 of file test_registry.py.

00943 
00944     def test_parseXML_empty( self ):
00945 
00946         site = self._initSite()
00947         configurator = self._makeOne().__of__( site )
00948 
00949         configurator.parseXML( _EMPTY_TOOLSET_XML )
00950 
00951         self.assertEqual( len( configurator.listForbiddenTools() ), 0 )
00952         self.assertEqual( len( configurator.listRequiredTools() ), 0 )

Definition at line 953 of file test_registry.py.

00953 
00954     def test_parseXML_normal( self ):
00955 
00956         site = self._initSite()
00957         configurator = self._makeOne().__of__( site )
00958 
00959         configurator.parseXML( _NORMAL_TOOLSET_XML )
00960 
00961         self.assertEqual( len( configurator.listForbiddenTools() ), 1 )
00962         self.failUnless( 'doomed' in configurator.listForbiddenTools() )
00963 
00964         self.assertEqual( len( configurator.listRequiredTools() ), 2 )
00965 
00966         self.failUnless( 'mandatory' in configurator.listRequiredTools() )
00967         info = configurator.getRequiredToolInfo( 'mandatory' )
00968         self.assertEqual( info[ 'class' ], 'path.to.one' )
00969 
00970         self.failUnless( 'obligatory' in configurator.listRequiredTools() )
00971         info = configurator.getRequiredToolInfo( 'obligatory' )
00972         self.assertEqual( info[ 'class' ], 'path.to.another' )


Member Data Documentation

Definition at line 811 of file test_registry.py.


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