def test_empty_adding_plugins(self):
            from Products.GenericSetup.tests.common import DummyImportContext
            from Products.GenericSetup.tests.faux_objects \
                import TestCSVAware, KNOWN_CSV
            from Products.PluggableAuthService.exportimport import importPAS

            self._setUpAdapters()
            app, pas = self._initPAS()

            context = DummyImportContext(pas)
            context._files['PAS/.objects'] = _PAS_WITH_CSV_PLUGIN_OBJECTS
            context._files['PAS/.properties'] = _EMPTY_PAS_PROPERTIES
            context._files[
                'PAS/pluginregistry.xml'] = _EMPTY_PLUGINREGISTRY_EXPORT
            context._files['PAS/csv_plugin.csv'] = KNOWN_CSV

            self.assertEqual(len(pas.objectIds()), 1)
            self.failUnless('plugins' in pas.objectIds())

            importPAS(context)

            self.assertEqual(len(pas.objectIds()), 2)
            self.failUnless('plugins' in pas.objectIds())
            self.failUnless('csv_plugin' in pas.objectIds())

            csv_plugin = pas._getOb('csv_plugin')
            self.failUnless(csv_plugin.__class__ is TestCSVAware)
            self.assertEqual(csv_plugin._was_put.getvalue().strip(),
                             KNOWN_CSV.strip())
Esempio n. 2
0
        def test_empty_adding_plugins(self):
            from Products.GenericSetup.tests.common import DummyImportContext
            from Products.GenericSetup.tests.faux_objects import TestCSVAware, KNOWN_CSV
            from Products.GenericSetup.utils import _getDottedName
            from Products.PluginRegistry.PluginRegistry import PluginRegistry
            from Products.PluggableAuthService.exportimport import importPAS

            self._setUpAdapters()
            app, pas = self._initPAS()

            context = DummyImportContext(pas)
            context._files["PAS/.objects"] = _PAS_WITH_CSV_PLUGIN_OBJECTS
            context._files["PAS/.properties"] = _EMPTY_PAS_PROPERTIES
            context._files["PAS/pluginregistry.xml"] = _EMPTY_PLUGINREGISTRY_EXPORT
            context._files["PAS/csv_plugin.csv"] = KNOWN_CSV

            self.assertEqual(len(pas.objectIds()), 1)
            self.failUnless("plugins" in pas.objectIds())

            importPAS(context)

            self.assertEqual(len(pas.objectIds()), 2)
            self.failUnless("plugins" in pas.objectIds())
            self.failUnless("csv_plugin" in pas.objectIds())

            csv_plugin = pas._getOb("csv_plugin")
            self.failUnless(csv_plugin.__class__ is TestCSVAware)
            self.assertEqual(csv_plugin._was_put.getvalue().strip(), KNOWN_CSV.strip())
    def test_empty_modifying_plugin_types(self):
        from Products.GenericSetup.tests.common import DummyImportContext
        from Products.PluggableAuthService.exportimport import importPAS

        self._setUpAdapters()
        app, pas = self._initPAS()

        ctx = DummyImportContext(pas)
        ctx._files['PAS/.objects'] = _EMPTY_PAS_OBJECTS
        ctx._files['PAS/.properties'] = _EMPTY_PAS_PROPERTIES
        ctx._files['PAS/pluginregistry.xml'] = _EMPTY_PLUGINREGISTRY_EXPORT

        self.assertTrue(pas.plugins.listPluginTypeInfo())
        importPAS(ctx)
        self.assertFalse(pas.plugins.listPluginTypeInfo())
Esempio n. 4
0
        def test_empty_modifying_plugin_types(self):
            from Products.GenericSetup.tests.common import DummyImportContext
            from Products.PluggableAuthService.exportimport import importPAS

            self._setUpAdapters()
            app, pas = self._initPAS()

            context = DummyImportContext(pas)
            context._files['PAS/.objects'] = _EMPTY_PAS_OBJECTS
            context._files['PAS/.properties'] = _EMPTY_PAS_PROPERTIES
            context._files['PAS/pluginregistry.xml'
                          ] = _EMPTY_PLUGINREGISTRY_EXPORT

            self.failUnless(pas.plugins.listPluginTypeInfo())
            importPAS(context)
            self.failIf(pas.plugins.listPluginTypeInfo())
Esempio n. 5
0
        def test_empty_modifying_plugin_types(self):
            from Products.GenericSetup.tests.common import DummyImportContext
            from Products.GenericSetup.utils import _getDottedName
            from Products.PluginRegistry.PluginRegistry import PluginRegistry
            from Products.PluggableAuthService.exportimport import importPAS

            self._setUpAdapters()
            app, pas = self._initPAS()

            context = DummyImportContext(pas)
            context._files['PAS/.objects'] = _EMPTY_PAS_OBJECTS
            context._files['PAS/.properties'] = _EMPTY_PAS_PROPERTIES
            context._files['PAS/pluginregistry.xml'
                          ] = _EMPTY_PLUGINREGISTRY_EXPORT

            self.failUnless(pas.plugins.listPluginTypeInfo())
            importPAS(context)
            self.failIf(pas.plugins.listPluginTypeInfo())