Back to index

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

List of all members.

Public Member Functions

def test_export_ini_file
def test_import_ini_file

Private Member Functions

def _getTargetClass
def _makeOne

Detailed Description

Definition at line 778 of file test_content.py.


Member Function Documentation

Definition at line 780 of file test_content.py.

00780 
00781     def _getTargetClass(self):
00782         from Products.GenericSetup.content import INIAwareFileAdapter
00783         return INIAwareFileAdapter

def GenericSetup.tests.test_content.INIAwareFileAdapterTests._makeOne (   self,
  context,
  args,
  kw 
) [private]

Definition at line 784 of file test_content.py.

00784 
00785     def _makeOne(self, context, *args, **kw):
00786         return self._getTargetClass()(context, *args, **kw)

Definition at line 787 of file test_content.py.

00787 
00788     def test_export_ini_file(self):
00789         ini_file = _makeINIAware('ini_file.html')
00790         adapter = self._makeOne(ini_file)
00791         context = DummyExportContext(None)
00792         adapter.export(context, 'subpath/to')
00793 
00794         self.assertEqual(len(context._wrote), 1)
00795         filename, text, content_type = context._wrote[0]
00796         self.assertEqual(filename, 'subpath/to/ini_file.html.ini')
00797         self.assertEqual(content_type, 'text/plain')
00798 
00799         self.assertEqual(text.strip(), ini_file.as_ini().strip())

Definition at line 800 of file test_content.py.

00800 
00801     def test_import_ini_file(self):
00802         from faux_objects import KNOWN_INI
00803         ini_file = _makeINIAware('ini_file.html')
00804         adapter = self._makeOne(ini_file)
00805         context = DummyImportContext(None)
00806         context._files['subpath/to/ini_file.html.ini'] = (
00807                         KNOWN_INI % ('Title: ini_file', 'abc'))
00808 
00809         adapter.import_(context, 'subpath/to')
00810         text = ini_file._was_put
00811         parser = ConfigParser()
00812         parser.readfp(StringIO(text))
00813         self.assertEqual(parser.get('DEFAULT', 'title'), 'Title: ini_file')
00814         self.assertEqual(parser.get('DEFAULT', 'description'), 'abc')
00815 


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