Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Private Member Functions
PluggableAuthService.plugins.tests.test_exportimport.TitleOnlyExportImportTests Class Reference
Inheritance diagram for PluggableAuthService.plugins.tests.test_exportimport.TitleOnlyExportImportTests:
Inheritance graph
[legend]
Collaboration diagram for PluggableAuthService.plugins.tests.test_exportimport.TitleOnlyExportImportTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_listExportableItems
def test__getExportInfo_no_title
def test__getExportInfo_with_title
def test_export_no_title
def test_export_with_title
def test_import_with_title
def test_import_no_title

Public Attributes

 title

Private Member Functions

def _getTargetClass
def _makePlugin

Detailed Description

Definition at line 790 of file test_exportimport.py.


Member Function Documentation

Definition at line 792 of file test_exportimport.py.

00792 
00793         def _getTargetClass(self):
00794             from Products.PluggableAuthService.plugins.exportimport \
00795                 import TitleOnlyExportImport
00796             return TitleOnlyExportImport

Definition at line 797 of file test_exportimport.py.

00797 
00798         def _makePlugin(self, id, *args, **kw):
00799             from OFS.SimpleItem import SimpleItem
00800 
00801             class _Plugin(SimpleItem):
00802                 title = None
00803 
00804                 def __init__(self, id, title=None):
00805                     self._setId(id)
00806                     if title is not None:
00807                         self.title = title
00808 
00809             return _Plugin(id, *args, **kw)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 816 of file test_exportimport.py.

00816 
00817         def test__getExportInfo_no_title(self):
00818             plugin = self._makePlugin('simple', None).__of__(self.root)
00819             adapter = self._makeOne(plugin)
00820 
00821             info = adapter._getExportInfo()
00822             self.assertEqual(info['title'], None)

Definition at line 823 of file test_exportimport.py.

00823 
00824         def test__getExportInfo_with_title(self):
00825             plugin = self._makePlugin('simple', None).__of__(self.root)
00826             plugin.title = 'Plugin Title'
00827             adapter = self._makeOne(plugin)
00828 
00829             info = adapter._getExportInfo()
00830             self.assertEqual(info['title'], 'Plugin Title')

Definition at line 831 of file test_exportimport.py.

00831 
00832         def test_export_no_title(self):
00833             plugin = self._makePlugin('no_title', None).__of__(self.root)
00834             adapter = self._makeOne(plugin)
00835 
00836             context = DummyExportContext(plugin)
00837             adapter.export(context, 'plugins', False)
00838 
00839             self.assertEqual( len( context._wrote ), 1 )
00840             filename, text, content_type = context._wrote[ 0 ]
00841             self.assertEqual( filename, 'plugins/no_title.xml' )
00842             self._compareDOM( text, _TITLE_ONLY_TEMPLATE_NO_TITLE )
00843             self.assertEqual( content_type, 'text/xml' )

Definition at line 844 of file test_exportimport.py.

00844 
00845         def test_export_with_title(self):
00846             TITLE = 'Plugin Title'
00847             plugin = self._makePlugin('with_title', None).__of__(self.root)
00848             plugin.title = TITLE
00849             adapter = self._makeOne(plugin)
00850 
00851             context = DummyExportContext(plugin)
00852             adapter.export(context, 'plugins', False)
00853 
00854             self.assertEqual( len( context._wrote ), 1 )
00855             filename, text, content_type = context._wrote[ 0 ]
00856             self.assertEqual( filename, 'plugins/with_title.xml' )
00857             self._compareDOM( text, _TITLE_ONLY_TEMPLATE % TITLE )
00858             self.assertEqual( content_type, 'text/xml' )

Definition at line 871 of file test_exportimport.py.

00871 
00872         def test_import_no_title(self):
00873             TITLE = 'Plugin Title'
00874             plugin = self._makePlugin('no_title').__of__(self.root)
00875             plugin.title = TITLE
00876             adapter = self._makeOne(plugin)
00877 
00878             context = DummyImportContext(plugin)
00879             context._files['plugins/no_title.xml'
00880                           ] = _TITLE_ONLY_TEMPLATE_NO_TITLE
00881 
00882             adapter.import_(context, 'plugins', False)
00883 
00884             self.assertEqual( plugin.title, None )
00885 
    class DelegatePathExportImportTests(_TestBase):

Definition at line 859 of file test_exportimport.py.

00859 
00860         def test_import_with_title(self):
00861             TITLE = 'Plugin Title'
00862             plugin = self._makePlugin('with_title').__of__(self.root)
00863             adapter = self._makeOne(plugin)
00864 
00865             context = DummyImportContext(plugin)
00866             context._files['plugins/with_title.xml'
00867                           ] = _TITLE_ONLY_TEMPLATE % TITLE
00868             adapter.import_(context, 'plugins', False)
00869 
00870             self.assertEqual( plugin.title, TITLE )

Definition at line 810 of file test_exportimport.py.

00810 
00811         def test_listExportableItems(self):
00812             plugin = self._makePlugin('lEI').__of__(self.root)
00813             adapter = self._makeOne(plugin)
00814 
00815             self.assertEqual(len(adapter.listExportableItems()), 0)


Member Data Documentation

Definition at line 806 of file test_exportimport.py.


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