Back to index

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

List of all members.

Public Member Functions

def test_empty
def test_getStep_nonesuch
def test_getStep_defaulted
def test_getStepMetadata_nonesuch
def test_getStepMetadata_defaulted
def test_registerStep_simple
def test_registerStep_docstring
def test_registerStep_docstring_with_override
def test_registerStep_collision
def test_generateXML_empty
def test_generateXML_single
def test_generateXML_ordered
def test_parseXML_empty
def test_parseXML_single
def test_parseXML_single_as_ascii

Static Public Attributes

 layer = ExportImportZCMLLayer

Private Member Functions

def _getTargetClass
def _makeOne

Detailed Description

Definition at line 582 of file test_registry.py.


Member Function Documentation

Definition at line 586 of file test_registry.py.

00586 
00587     def _getTargetClass( self ):
00588 
00589         from Products.GenericSetup.registry import ExportStepRegistry
00590         return ExportStepRegistry

def GenericSetup.tests.test_registry.ExportStepRegistryTests._makeOne (   self,
  args,
  kw 
) [private]

Definition at line 591 of file test_registry.py.

00591 
00592     def _makeOne( self, *args, **kw ):
00593 
00594         return self._getTargetClass()( *args, **kw )

Definition at line 595 of file test_registry.py.

00595 
00596     def test_empty( self ):
00597 
00598         registry = self._makeOne()
00599         self.assertEqual( len( registry.listSteps() ), 0 )
00600         self.assertEqual( len( registry.listStepMetadata() ), 0 )

Definition at line 668 of file test_registry.py.

00668 
00669     def test_generateXML_empty( self ):
00670 
00671         registry = self._makeOne().__of__(self.app)
00672 
00673         xml = registry.generateXML()
00674 
00675         self._compareDOM( registry.generateXML(), _EMPTY_EXPORT_XML )

Definition at line 688 of file test_registry.py.

00688 
00689     def test_generateXML_ordered( self ):
00690 
00691         registry = self._makeOne().__of__(self.app)
00692 
00693         registry.registerStep( id='one'
00694                              , handler=ONE_FUNC
00695                              , title='One Step'
00696                              , description='One small step'
00697                              )
00698 
00699         registry.registerStep( id='two'
00700                              , handler=TWO_FUNC
00701                              , title='Two Steps'
00702                              , description='Texas two step'
00703                              )
00704 
00705         registry.registerStep( id='three'
00706                              , handler=THREE_FUNC
00707                              , title='Three Steps'
00708                              , description='Gimme three steps'
00709                              )
00710 
00711         self._compareDOM( registry.generateXML(), _ORDERED_EXPORT_XML )

Definition at line 676 of file test_registry.py.

00676 
00677     def test_generateXML_single( self ):
00678 
00679         registry = self._makeOne().__of__(self.app)
00680 
00681         registry.registerStep( id='one'
00682                              , handler=ONE_FUNC
00683                              , title='One Step'
00684                              , description='One small step'
00685                              )
00686 
00687         self._compareDOM( registry.generateXML(), _SINGLE_EXPORT_XML )

Definition at line 606 of file test_registry.py.

00606 
00607     def test_getStep_defaulted( self ):
00608 
00609         registry = self._makeOne()
00610         default = lambda x: false
00611         self.assertEqual( registry.getStep( 'nonesuch', default ), default )

Definition at line 601 of file test_registry.py.

00601 
00602     def test_getStep_nonesuch( self ):
00603 
00604         registry = self._makeOne()
00605         self.assertEqual( registry.getStep( 'nonesuch' ), None )

Definition at line 617 of file test_registry.py.

00617 
00618     def test_getStepMetadata_defaulted( self ):
00619 
00620         registry = self._makeOne()
00621         self.assertEqual( registry.getStepMetadata( 'nonesuch', {} ), {} )

Definition at line 612 of file test_registry.py.

00612 
00613     def test_getStepMetadata_nonesuch( self ):
00614 
00615         registry = self._makeOne()
00616         self.assertEqual( registry.getStepMetadata( 'nonesuch' ), None )

Definition at line 712 of file test_registry.py.

00712 
00713     def test_parseXML_empty( self ):
00714 
00715         registry = self._makeOne().__of__(self.app)
00716 
00717         registry.registerStep( id='one'
00718                              , handler=ONE_FUNC
00719                              , description='One small step'
00720                              )
00721 
00722         info_list = registry.parseXML( _EMPTY_EXPORT_XML )
00723 
00724         self.assertEqual( len( info_list ), 0 )

Definition at line 725 of file test_registry.py.

00725 
00726     def test_parseXML_single( self ):
00727 
00728         registry = self._makeOne().__of__(self.app)
00729 
00730         registry.registerStep( id='two'
00731                              , handler=TWO_FUNC
00732                              , title='Two Steps'
00733                              , description='Texas two step'
00734                              )
00735 
00736         info_list = registry.parseXML( _SINGLE_EXPORT_XML )
00737 
00738         self.assertEqual( len( info_list ), 1 )
00739 
00740         info = info_list[ 0 ]
00741         self.assertEqual( info[ 'id' ], 'one' )
00742         self.assertEqual( info[ 'handler' ], ONE_FUNC_NAME )
00743         self.assertEqual( info[ 'title' ], 'One Step' )
00744         self.failUnless( 'One small step' in info[ 'description' ] )

Definition at line 745 of file test_registry.py.

00745 
00746     def test_parseXML_single_as_ascii( self ):
00747 
00748         registry = self._makeOne().__of__(self.app)
00749 
00750         registry.registerStep( id='two'
00751                              , handler=TWO_FUNC
00752                              , title='Two Steps'
00753                              , description='Texas two step'
00754                              )
00755 
00756         info_list = registry.parseXML( _SINGLE_EXPORT_XML, encoding='ascii' )
00757 
00758         self.assertEqual( len( info_list ), 1 )
00759 
00760         info = info_list[ 0 ]
00761         self.assertEqual( info[ 'id' ], 'one' )
00762         self.assertEqual( info[ 'handler' ], ONE_FUNC_NAME )
00763         self.assertEqual( info[ 'title' ], 'One Step' )
00764         self.failUnless( 'One small step' in info[ 'description' ] )
00765 

Definition at line 656 of file test_registry.py.

00656 
00657     def test_registerStep_collision( self ):
00658 
00659         registry = self._makeOne()
00660         registry.registerStep( 'one', ONE_FUNC )
00661         registry.registerStep( 'one', TWO_FUNC )
00662         info = registry.getStepMetadata( 'one', {} )
00663 
00664         self.assertEqual( info[ 'id' ], 'one' )
00665         self.assertEqual( info[ 'handler' ], TWO_FUNC_NAME )
00666         self.assertEqual( info[ 'title' ], 'one' )
00667         self.assertEqual( info[ 'description' ], '' )

Definition at line 633 of file test_registry.py.

00633 
00634     def test_registerStep_docstring( self ):
00635 
00636         registry = self._makeOne()
00637         registry.registerStep( 'one', DOC_FUNC )
00638         info = registry.getStepMetadata( 'one', {} )
00639 
00640         self.assertEqual( info[ 'id' ], 'one' )
00641         self.assertEqual( info[ 'handler' ], DOC_FUNC_NAME )
00642         self.assertEqual( info[ 'title' ], 'This is the first line.' )
00643         self.assertEqual( info[ 'description' ] , 'This is the second line.' )

Definition at line 644 of file test_registry.py.

00644 
00645     def test_registerStep_docstring_with_override( self ):
00646 
00647         registry = self._makeOne()
00648         registry.registerStep( 'one', DOC_FUNC
00649                                , description='Description' )
00650         info = registry.getStepMetadata( 'one', {} )
00651 
00652         self.assertEqual( info[ 'id' ], 'one' )
00653         self.assertEqual( info[ 'handler' ], DOC_FUNC_NAME )
00654         self.assertEqual( info[ 'title' ], 'This is the first line.' )
00655         self.assertEqual( info[ 'description' ], 'Description' )

Definition at line 622 of file test_registry.py.

00622 
00623     def test_registerStep_simple( self ):
00624 
00625         registry = self._makeOne()
00626         registry.registerStep( 'one', ONE_FUNC_NAME )
00627         info = registry.getStepMetadata( 'one', {} )
00628 
00629         self.assertEqual( info[ 'id' ], 'one' )
00630         self.assertEqual( info[ 'handler' ], ONE_FUNC_NAME )
00631         self.assertEqual( info[ 'title' ], 'one' )
00632         self.assertEqual( info[ 'description' ], '' )


Member Data Documentation

Definition at line 584 of file test_registry.py.


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