Back to index

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

List of all members.

Public Member Functions

def test_export_with_known_CSV
def test_import_with_known_CSV

Private Member Functions

def _getTargetClass
def _makeOne

Detailed Description

Definition at line 726 of file test_content.py.


Member Function Documentation

Definition at line 728 of file test_content.py.

00728 
00729     def _getTargetClass(self):
00730         from Products.GenericSetup.content import CSVAwareFileAdapter
00731         return CSVAwareFileAdapter

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

Definition at line 732 of file test_content.py.

00732 
00733     def _makeOne(self, context, *args, **kw):
00734         return self._getTargetClass()(context, *args, **kw)

Definition at line 735 of file test_content.py.

00735 
00736     def test_export_with_known_CSV(self):
00737         from faux_objects import KNOWN_CSV
00738         sheet = _makeCSVAware('config')
00739 
00740         adapter = self._makeOne(sheet)
00741         context = DummyExportContext(None)
00742         adapter.export(context, 'subpath/to/sheet')
00743 
00744         self.assertEqual(len(context._wrote), 1)
00745         filename, text, content_type = context._wrote[0]
00746         self.assertEqual(filename, 'subpath/to/sheet/config.csv')
00747         self.assertEqual(content_type, 'text/comma-separated-values')
00748 
00749         self.assertEqual(text.strip(), KNOWN_CSV.strip())

Definition at line 750 of file test_content.py.

00750 
00751     def test_import_with_known_CSV(self):
00752         ORIG_CSV = """\
00753 one,two,three
00754 four,five,six
00755 """
00756         NEW_CSV = """\
00757 four,five,six
00758 one,two,three
00759 """
00760         sheet = _makeCSVAware('config', ORIG_CSV)
00761 
00762         adapter = self._makeOne(sheet)
00763         context = DummyImportContext(None)
00764         context._files['subpath/to/sheet/config.csv'] = NEW_CSV
00765         adapter.import_(context, 'subpath/to/sheet')
00766 
00767         self.assertEqual(sheet._was_put.getvalue().strip(), NEW_CSV.strip())
00768 


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