Back to index

plone3  3.1.7
Public Member Functions | Private Member Functions
GenericSetup.tests.test_context.TarballExportContextTests Class Reference
Inheritance diagram for GenericSetup.tests.test_context.TarballExportContextTests:
Inheritance graph
[legend]
Collaboration diagram for GenericSetup.tests.test_context.TarballExportContextTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_getLogger
def test_writeDataFile_simple
def test_writeDataFile_multiple
def test_writeDataFile_subdir

Private Member Functions

def _getTargetClass

Detailed Description

Definition at line 741 of file test_context.py.


Member Function Documentation

Definition at line 743 of file test_context.py.

00743 
00744     def _getTargetClass( self ):
00745 
00746         from Products.GenericSetup.context import TarballExportContext
00747         return TarballExportContext

Definition at line 748 of file test_context.py.

00748 
00749     def test_getLogger( self ):
00750 
00751         site = DummySite('site').__of__(self.app)
00752         ctx = self._getTargetClass()( site )
00753 
00754         self.assertEqual( len( ctx.listNotes() ), 0 )
00755 
00756         logger = ctx.getLogger('foo')
00757         logger.info('bar')
00758 
00759         self.assertEqual( len( ctx.listNotes() ), 1 )
00760         level, component, message = ctx.listNotes()[0]
00761         self.assertEqual( level, logging.INFO )
00762         self.assertEqual( component, 'foo' )
00763         self.assertEqual( message, 'bar' )
00764 
00765         ctx.clearNotes()
00766         self.assertEqual( len( ctx.listNotes() ), 0 )

Definition at line 782 of file test_context.py.

00782 
00783     def test_writeDataFile_multiple( self ):
00784 
00785         from string import printable
00786         from string import digits
00787 
00788         site = DummySite('site').__of__(self.app)
00789         ctx = self._getTargetClass()( site )
00790 
00791         ctx.writeDataFile( 'foo.txt', printable, 'text/plain' )
00792         ctx.writeDataFile( 'bar.txt', digits, 'text/plain' )
00793 
00794         fileish = StringIO( ctx.getArchive() )
00795 
00796         self._verifyTarballContents( fileish, [ 'foo.txt', 'bar.txt' ] )
00797         self._verifyTarballEntry( fileish, 'foo.txt', printable )
00798         self._verifyTarballEntry( fileish, 'bar.txt', digits )

Definition at line 767 of file test_context.py.

00767 
00768     def test_writeDataFile_simple( self ):
00769 
00770         from string import printable
00771         now = long( time.time() )
00772 
00773         site = DummySite('site').__of__(self.app)
00774         ctx = self._getTargetClass()( site )
00775 
00776         ctx.writeDataFile( 'foo.txt', printable, 'text/plain' )
00777 
00778         fileish = StringIO( ctx.getArchive() )
00779 
00780         self._verifyTarballContents( fileish, [ 'foo.txt' ], now )
00781         self._verifyTarballEntry( fileish, 'foo.txt', printable )

Definition at line 799 of file test_context.py.

00799 
00800     def test_writeDataFile_subdir( self ):
00801 
00802         from string import printable
00803         from string import digits
00804 
00805         site = DummySite('site').__of__(self.app)
00806         ctx = self._getTargetClass()( site )
00807 
00808         ctx.writeDataFile( 'foo.txt', printable, 'text/plain' )
00809         ctx.writeDataFile( 'bar/baz.txt', digits, 'text/plain' )
00810 
00811         fileish = StringIO( ctx.getArchive() )
00812 
00813         self._verifyTarballContents( fileish, [ 'foo.txt', 'bar/baz.txt' ] )
00814         self._verifyTarballEntry( fileish, 'foo.txt', printable )
00815         self._verifyTarballEntry( fileish, 'bar/baz.txt', digits )
00816 


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