Back to index

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

List of all members.

Public Member Functions

def test_getLogger
def test_writeDataFile_simple
def test_writeDataFile_new_subdir
def test_writeDataFile_overwrite
def test_writeDataFile_existing_subdir

Private Member Functions

def _getTargetClass

Static Private Attributes

string _PROFILE_PATH = '/tmp/ECTTexts'

Detailed Description

Definition at line 342 of file test_context.py.


Member Function Documentation

Definition at line 346 of file test_context.py.

00346 
00347     def _getTargetClass( self ):
00348 
00349         from Products.GenericSetup.context import DirectoryExportContext
00350         return DirectoryExportContext

Definition at line 351 of file test_context.py.

00351 
00352     def test_getLogger( self ):
00353 
00354         site = DummySite('site').__of__(self.app)
00355         ctx = self._makeOne( site, self._PROFILE_PATH )
00356         self.assertEqual( len( ctx.listNotes() ), 0 )
00357 
00358         logger = ctx.getLogger('foo')
00359         logger.info('bar')
00360 
00361         self.assertEqual( len( ctx.listNotes() ), 1 )
00362         level, component, message = ctx.listNotes()[0]
00363         self.assertEqual( level, logging.INFO )
00364         self.assertEqual( component, 'foo' )
00365         self.assertEqual( message, 'bar' )
00366 
00367         ctx.clearNotes()
00368         self.assertEqual( len( ctx.listNotes() ), 0 )

Definition at line 411 of file test_context.py.

00411 
00412     def test_writeDataFile_existing_subdir( self ):
00413 
00414         from string import printable, digits
00415         SUBDIR = 'subdir'
00416         FILENAME = 'nested.txt'
00417         self._makeFile( os.path.join( SUBDIR, 'another.txt' ), printable )
00418         fqname = os.path.join( self._PROFILE_PATH, SUBDIR, FILENAME )
00419 
00420         site = DummySite('site').__of__(self.app)
00421         ctx = self._makeOne( site, self._PROFILE_PATH )
00422 
00423         ctx.writeDataFile( FILENAME, digits, 'text/plain', SUBDIR )
00424 
00425         self.assertEqual( open( fqname, 'rb' ).read(), digits )
00426 

Definition at line 382 of file test_context.py.

00382 
00383     def test_writeDataFile_new_subdir( self ):
00384 
00385         from string import printable, digits
00386         SUBDIR = 'subdir'
00387         FILENAME = 'nested.txt'
00388         fqname = os.path.join( self._PROFILE_PATH, SUBDIR, FILENAME )
00389 
00390         site = DummySite('site').__of__(self.app)
00391         ctx = self._makeOne( site, self._PROFILE_PATH )
00392 
00393         ctx.writeDataFile( FILENAME, digits, 'text/plain', SUBDIR )
00394 
00395         self.assertEqual( open( fqname, 'rb' ).read(), digits )

Definition at line 396 of file test_context.py.

00396 
00397     def test_writeDataFile_overwrite( self ):
00398 
00399         from string import printable, digits
00400         SUBDIR = 'subdir'
00401         FILENAME = 'nested.txt'
00402         fqname = self._makeFile( os.path.join( SUBDIR, FILENAME )
00403                                , printable )
00404 
00405         site = DummySite('site').__of__(self.app)
00406         ctx = self._makeOne( site, self._PROFILE_PATH )
00407 
00408         ctx.writeDataFile( FILENAME, digits, 'text/plain', SUBDIR )
00409 
00410         self.assertEqual( open( fqname, 'rb' ).read(), digits )

Definition at line 369 of file test_context.py.

00369 
00370     def test_writeDataFile_simple( self ):
00371 
00372         from string import printable, digits
00373         FILENAME = 'simple.txt'
00374         fqname = self._makeFile( FILENAME, printable )
00375 
00376         site = DummySite('site').__of__(self.app)
00377         ctx = self._makeOne( site, self._PROFILE_PATH )
00378 
00379         ctx.writeDataFile( FILENAME, digits, 'text/plain' )
00380 
00381         self.assertEqual( open( fqname, 'rb' ).read(), digits )


Member Data Documentation

Definition at line 344 of file test_context.py.


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