Back to index

plone3  3.1.7
Classes | Functions | Variables
CMFCore.exportimport.tests.test_content Namespace Reference

Classes

class  SiteStructureExporterTests

Functions

def _makeCSVAware
def _makeINIAware
def _makeDAVAware
def _makeItem
def _makeFolder
def test_suite

Variables

string TEST_CSV_AWARE = 'Test CSV Aware'
string KNOWN_CSV
string TEST_INI_AWARE = 'Test INI Aware'
string KNOWN_INI
string TEST_DAV_AWARE = 'Test DAV Aware'
string KNOWN_DAV
string TEST_CONTENT = 'Test Content'
string TEST_FOLDER = 'Test Folder'
 _was_put
 _was_put_as_read

Function Documentation

Definition at line 628 of file test_content.py.

00628 
00629 def _makeCSVAware(id):
00630     from OFS.SimpleItem import SimpleItem
00631     from zope.interface import implements
00632     from Products.CMFCore.interfaces import IDynamicType
00633     from Products.GenericSetup.interfaces import ICSVAware
00634 
00635     class _TestCSVAware(SimpleItem):
00636         implements(IDynamicType, ICSVAware)
00637         _was_put = None
00638         portal_type = TEST_CSV_AWARE
00639 
00640         def getPortalTypeName(self):
00641             return self.portal_type
00642 
00643         def as_csv(self):
00644             return KNOWN_CSV
00645 
00646         def put_csv(self, text):
00647             self._was_put = text
00648 
00649     aware = _TestCSVAware()
00650     aware._setId(id)
00651 
00652     return aware
00653 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 697 of file test_content.py.

00697 
00698 def _makeDAVAware(id):
00699     from OFS.SimpleItem import SimpleItem
00700     from zope.interface import implements
00701     from Products.CMFCore.interfaces import IDynamicType
00702     from Products.GenericSetup.interfaces import IDAVAware
00703 
00704     class _TestDAVAware(SimpleItem):
00705         implements(IDynamicType, IDAVAware)
00706         _was_put = None
00707         title = 'DAV title'
00708         description = 'DAV description'
00709         body = 'DAV body'
00710         portal_type = TEST_DAV_AWARE
00711 
00712         def getPortalTypeName(self):
00713             return self.portal_type
00714 
00715         def manage_FTPget(self):
00716             return KNOWN_DAV % (self.title, self.description, self.body)
00717 
00718         def PUT(self, REQUEST, RESPONSE):
00719             self._was_put = REQUEST.get('BODY', '')
00720             stream = REQUEST.get('BODYFILE', None)
00721             self._was_put_as_read = stream.read()
00722 
00723     aware = _TestDAVAware()
00724     aware._setId(id)
00725 
00726     return aware
00727 

Here is the call graph for this function:

def CMFCore.exportimport.tests.test_content._makeFolder (   id,
  site_folder = False 
) [private]

Definition at line 750 of file test_content.py.

00750 
00751 def _makeFolder(id, site_folder=False):
00752     from Products.CMFCore.PortalFolder import PortalFolder
00753     from Products.CMFCore.TypesTool import TypesTool
00754     from Products.CMFCore.tests.base.dummy import DummyType
00755 
00756     class _TypeInfo(DummyType):
00757         def _getId(self):
00758             return self._id
00759         def constructInstance(self, container, id, *args, **kw):
00760             portal_type = self._getId()
00761             if portal_type == TEST_FOLDER:
00762                 content = PortalFolder(id)
00763             elif portal_type == TEST_CONTENT:
00764                 content = _makeItem()
00765                 content._setId(id)
00766             elif portal_type == TEST_INI_AWARE:
00767                 content = _makeINIAware(id)
00768             elif portal_type == TEST_CSV_AWARE:
00769                 content = _makeCSVAware(id)
00770             else:
00771                 raise ValueError, 'Ugh'
00772             content.portal_type = portal_type
00773             container._setObject(id, content)
00774             return container._getOb(id)
00775 
00776     folder = PortalFolder(id)
00777     folder.portal_type = TEST_FOLDER
00778     if site_folder:
00779         tool = folder.portal_types = TypesTool()
00780         tool._setObject(TEST_CSV_AWARE, _TypeInfo(TEST_CSV_AWARE))
00781         tool._setObject(TEST_INI_AWARE, _TypeInfo(TEST_INI_AWARE))
00782         tool._setObject(TEST_CONTENT, _TypeInfo(TEST_CONTENT))
00783         tool._setObject(TEST_FOLDER, _TypeInfo(TEST_FOLDER))
00784 
00785     return folder
00786 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 661 of file test_content.py.

00661 
00662 def _makeINIAware(id):
00663     from OFS.SimpleItem import SimpleItem
00664     from zope.interface import implements
00665     from Products.CMFCore.interfaces import IDynamicType
00666     from Products.GenericSetup.interfaces import IINIAware
00667 
00668     class _TestINIAware(SimpleItem):
00669         implements(IDynamicType, IINIAware)
00670         _was_put = None
00671         title = 'INI title'
00672         description = 'INI description'
00673         portal_type = TEST_INI_AWARE
00674 
00675         def getPortalTypeName(self):
00676             return self.portal_type
00677 
00678         def as_ini(self):
00679             return KNOWN_INI % (self.title, self.description)
00680 
00681         def put_ini(self, text):
00682             self._was_put = text
00683 
00684     aware = _TestINIAware()
00685     aware._setId(id)
00686 
00687     return aware
00688 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 730 of file test_content.py.

00730 
00731 def _makeItem(self):
00732     from OFS.SimpleItem import SimpleItem
00733     from zope.interface import implements
00734     from Products.CMFCore.interfaces import IDynamicType
00735 
00736     class _TestContent(SimpleItem):
00737         implements(IDynamicType)
00738         portal_type = TEST_CONTENT
00739 
00740         def getPortalTypeName(self):
00741             return self.portal_type
00742 
00743     aware = _TestContent()
00744     aware._setId(id)
00745 
00746     return aware
00747 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 787 of file test_content.py.

00787 
00788 def test_suite():
00789     suite = unittest.TestSuite()
00790     suite.addTest(unittest.makeSuite(SiteStructureExporterTests))
00791     return suite


Variable Documentation

Definition at line 646 of file test_content.py.

Definition at line 720 of file test_content.py.

Initial value:
00001 """\
00002 one,two,three
00003 four,five,six
00004 """

Definition at line 623 of file test_content.py.

Initial value:
00001 """\
00002 Title: %s
00003 Description: %s
00004 
00005 %s
00006 """

Definition at line 690 of file test_content.py.

Initial value:
00001 """\
00002 [DEFAULT]
00003 title = %s
00004 description = %s
00005 """

Definition at line 655 of file test_content.py.

Definition at line 728 of file test_content.py.

Definition at line 622 of file test_content.py.

Definition at line 689 of file test_content.py.

Definition at line 748 of file test_content.py.

Definition at line 654 of file test_content.py.