Back to index

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

List of all members.

Public Member Functions

def test_listExportableItems
def test__getExportInfo_default
def test_export_default
def test__getExportInfo_explicitly_set
def test_export_explicitly_set
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 885 of file test_exportimport.py.


Member Function Documentation

Definition at line 887 of file test_exportimport.py.

00887 
00888         def _getTargetClass(self):
00889             from Products.PluggableAuthService.plugins.exportimport \
00890                 import DelegatePathExportImport
00891             return DelegatePathExportImport

Definition at line 892 of file test_exportimport.py.

00892 
00893         def _makePlugin(self, id, *args, **kw):
00894             from OFS.SimpleItem import SimpleItem
00895 
00896             class _Plugin(SimpleItem):
00897                 title = None
00898                 delegate = ''
00899 
00900                 def __init__(self, id, title=None):
00901                     self._setId(id)
00902                     if title is not None:
00903                         self.title = title
00904 
00905             return _Plugin(id, *args, **kw)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 914 of file test_exportimport.py.

00914 
00915         def test__getExportInfo_default(self):
00916             plugin = self._makePlugin('default').__of__(self.root)
00917             adapter = self._makeOne(plugin)
00918 
00919             info = adapter._getExportInfo()
00920             self.assertEqual(info['title'], None)
00921             self.assertEqual(info['delegate'], '')

Definition at line 935 of file test_exportimport.py.

00935 
00936         def test__getExportInfo_explicitly_set(self):
00937             TITLE = 'Plugin Title'
00938             DELEGATE_PATH = 'path/to/delegate'
00939             plugin = self._makePlugin('explicit').__of__(self.root)
00940             plugin.title = TITLE
00941             plugin.delegate = DELEGATE_PATH
00942             adapter = self._makeOne(plugin)
00943 
00944             info = adapter._getExportInfo()
00945             self.assertEqual(info['title'], TITLE)
00946             self.assertEqual(info['delegate'], DELEGATE_PATH)

Definition at line 922 of file test_exportimport.py.

00922 
00923         def test_export_default(self):
00924             plugin = self._makePlugin('default').__of__(self.root)
00925             adapter = self._makeOne(plugin)
00926 
00927             context = DummyExportContext(plugin)
00928             adapter.export(context, 'plugins', False)
00929 
00930             self.assertEqual(len(context._wrote), 1)
00931             filename, text, content_type = context._wrote[0]
00932             self.assertEqual(filename, 'plugins/default.xml' )
00933             self._compareDOM(text, _DELEGATE_PATH_TEMPLATE_NO_TITLE % "")
00934             self.assertEqual( content_type, 'text/xml' )

Definition at line 947 of file test_exportimport.py.

00947 
00948         def test_export_explicitly_set(self):
00949             TITLE = 'Plugin Title'
00950             DELEGATE_PATH = 'path/to/delegate'
00951             plugin = self._makePlugin('explicit').__of__(self.root)
00952             plugin.title = TITLE
00953             plugin.delegate = DELEGATE_PATH
00954             adapter = self._makeOne(plugin)
00955 
00956             context = DummyExportContext(plugin)
00957             adapter.export(context, 'plugins', False)
00958 
00959             self.assertEqual(len(context._wrote), 1)
00960             filename, text, content_type = context._wrote[0]
00961             self.assertEqual(filename, 'plugins/explicit.xml' )
00962             self._compareDOM(text,
00963                              _DELEGATE_PATH_TEMPLATE % (TITLE,
00964                                                         DELEGATE_PATH,
00965                                                        ))
00966             self.assertEqual( content_type, 'text/xml' )

Definition at line 983 of file test_exportimport.py.

00983 
00984         def test_import_no_title(self):
00985             TITLE = 'Plugin Title'
00986             DELEGATE_PATH = 'path/to/delegate'
00987             plugin = self._makePlugin('no_title').__of__(self.root)
00988             plugin.title = TITLE
00989             plugin.delegate = DELEGATE_PATH
00990             adapter = self._makeOne(plugin)
00991 
00992             context = DummyImportContext(plugin)
00993             context._files['plugins/no_title.xml'
00994                           ] = _DELEGATE_PATH_TEMPLATE_NO_TITLE % DELEGATE_PATH
00995             adapter.import_(context, 'plugins', False)
00996 
00997             self.assertEqual( plugin.title, None )
00998             self.assertEqual( plugin.delegate, DELEGATE_PATH )
00999 
    class DynamicGroupsPluginExportImportTests(_TestBase):

Definition at line 967 of file test_exportimport.py.

00967 
00968         def test_import_with_title(self):
00969             TITLE = 'Plugin Title'
00970             DELEGATE_PATH = 'path/to/delegate'
00971             plugin = self._makePlugin('with_title').__of__(self.root)
00972             adapter = self._makeOne(plugin)
00973 
00974             context = DummyImportContext(plugin)
00975             context._files['plugins/with_title.xml'
00976                           ] = _DELEGATE_PATH_TEMPLATE % (TITLE,
00977                                                          DELEGATE_PATH,
00978                                                         )
00979             adapter.import_(context, 'plugins', False)
00980 
00981             self.assertEqual( plugin.title, TITLE )
00982             self.assertEqual( plugin.delegate, DELEGATE_PATH )

Definition at line 906 of file test_exportimport.py.

00906 
00907         def test_listExportableItems(self):
00908             plugin = self._makePlugin('lEI').__of__(self.root)
00909             adapter = self._makeOne(plugin)
00910 
00911             self.assertEqual(len(adapter.listExportableItems()), 0)
00912             plugin.delegate = 'path/to/delegate'
00913             self.assertEqual(len(adapter.listExportableItems()), 0)


Member Data Documentation

Definition at line 902 of file test_exportimport.py.


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