Back to index

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

List of all members.

Public Member Functions

def test_empty_modifying_plugin_types
def test_empty_adding_plugins

Private Member Functions

def _setUpAdapters

Detailed Description

Definition at line 216 of file test_exportimport.py.


Member Function Documentation

Definition at line 218 of file test_exportimport.py.

00218 
00219         def _setUpAdapters(self):
00220             from zope.app.testing import ztapi
00221 
00222             try:
00223                 from OFS.interfaces import IObjectManager
00224                 from OFS.interfaces import IPropertyManager
00225                 from OFS.interfaces import ISimpleItem
00226             except ImportError: # BBB
00227                 from Products.Five.interfaces import IObjectManager
00228                 from Products.Five.interfaces import IPropertyManager
00229                 from Products.Five.interfaces import ISimpleItem
00230 
00231             from Products.GenericSetup.interfaces import IContentFactory
00232             from Products.GenericSetup.interfaces import ICSVAware
00233             from Products.GenericSetup.interfaces import IDAVAware
00234             from Products.GenericSetup.interfaces import IFilesystemImporter
00235             from Products.GenericSetup.interfaces import IINIAware
00236 
00237             from Products.GenericSetup.content import \
00238                 FolderishExporterImporter
00239             from Products.GenericSetup.content import \
00240                 SimpleINIAware
00241             from Products.GenericSetup.content import \
00242                 CSVAwareFileAdapter
00243             from Products.GenericSetup.content import \
00244                 INIAwareFileAdapter
00245             from Products.GenericSetup.content import \
00246                 DAVAwareFileAdapter
00247 
00248             from Products.PluginRegistry.interfaces import IPluginRegistry
00249             from Products.PluginRegistry.exportimport \
00250                 import PluginRegistryFileExportImportAdapter
00251 
00252             from Products.PluggableAuthService.interfaces.authservice \
00253                 import IPluggableAuthService
00254             from Products.PluggableAuthService.exportimport \
00255                 import PAS_PR_ContentFactory
00256 
00257             ztapi.provideAdapter(IObjectManager,
00258                                  IFilesystemImporter,
00259                                  FolderishExporterImporter,
00260                                 )
00261 
00262             ztapi.provideAdapter(IPropertyManager,
00263                                  IINIAware,
00264                                  SimpleINIAware,
00265                                 )
00266 
00267             ztapi.provideAdapter(ICSVAware,
00268                                  IFilesystemImporter,
00269                                  CSVAwareFileAdapter,
00270                                 )
00271 
00272             ztapi.provideAdapter(IINIAware,
00273                                  IFilesystemImporter,
00274                                  INIAwareFileAdapter,
00275                                 )
00276 
00277             ztapi.provideAdapter(IDAVAware,
00278                                  IFilesystemImporter,
00279                                  DAVAwareFileAdapter,
00280                                 )
00281 
00282             ztapi.provideAdapter(IPluginRegistry,
00283                                  IFilesystemImporter,
00284                                  PluginRegistryFileExportImportAdapter,
00285                                 )
00286 
00287             ztapi.provideAdapter(IPluggableAuthService,
00288                                  IContentFactory,
00289                                  PAS_PR_ContentFactory,
00290                                  name='plugins',
00291                                 )

Here is the caller graph for this function:

Definition at line 311 of file test_exportimport.py.

00311 
00312         def test_empty_adding_plugins(self):
00313             from Products.GenericSetup.tests.common import DummyImportContext
00314             from Products.GenericSetup.tests.faux_objects \
00315                 import TestCSVAware, KNOWN_CSV
00316             from Products.GenericSetup.utils import _getDottedName
00317             from Products.PluginRegistry.PluginRegistry import PluginRegistry
00318             from Products.PluggableAuthService.exportimport import importPAS
00319 
00320             self._setUpAdapters()
00321             app, pas = self._initPAS()
00322 
00323             context = DummyImportContext(pas)
00324             context._files['PAS/.objects'] = _PAS_WITH_CSV_PLUGIN_OBJECTS
00325             context._files['PAS/.properties'] = _EMPTY_PAS_PROPERTIES
00326             context._files['PAS/pluginregistry.xml'
00327                           ] = _EMPTY_PLUGINREGISTRY_EXPORT
00328             context._files['PAS/csv_plugin.csv'
00329                           ] = KNOWN_CSV
00330 
00331             self.assertEqual(len(pas.objectIds()), 1)
00332             self.failUnless('plugins' in pas.objectIds())
00333 
00334             importPAS(context)
00335 
00336             self.assertEqual(len(pas.objectIds()), 2)
00337             self.failUnless('plugins' in pas.objectIds())
00338             self.failUnless('csv_plugin' in pas.objectIds())
00339 
00340             csv_plugin = pas._getOb('csv_plugin')
00341             self.failUnless(csv_plugin.__class__ is TestCSVAware)
00342             self.assertEqual(csv_plugin._was_put.getvalue().strip(),
00343                              KNOWN_CSV.strip())
00344 
00345 
    _EMPTY_PAS_OBJECTS = """\

Here is the call graph for this function:

Definition at line 292 of file test_exportimport.py.

00292 
00293         def test_empty_modifying_plugin_types(self):
00294             from Products.GenericSetup.tests.common import DummyImportContext
00295             from Products.GenericSetup.utils import _getDottedName
00296             from Products.PluginRegistry.PluginRegistry import PluginRegistry
00297             from Products.PluggableAuthService.exportimport import importPAS
00298 
00299             self._setUpAdapters()
00300             app, pas = self._initPAS()
00301 
00302             context = DummyImportContext(pas)
00303             context._files['PAS/.objects'] = _EMPTY_PAS_OBJECTS
00304             context._files['PAS/.properties'] = _EMPTY_PAS_PROPERTIES
00305             context._files['PAS/pluginregistry.xml'
00306                           ] = _EMPTY_PLUGINREGISTRY_EXPORT
00307 
00308             self.failUnless(pas.plugins.listPluginTypeInfo())
00309             importPAS(context)
00310             self.failIf(pas.plugins.listPluginTypeInfo())

Here is the call graph for this function:


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