def test_OddballIndex(self):
     # Some indexes, e.g. Plone's 'GopipIndex', use ths adapter but don't
     # have 'indexed_attrs'.
     from xml.dom.minidom import parseString
     from Products.GenericSetup.testing import DummySetupEnviron
     from Products.GenericSetup.PluginIndexes.exportimport \
             import PluggableIndexNodeAdapter
     class Oddball(object):
         def clear(*a):
             raise AssertionError("Don't clear me!")
     index = Oddball()
     environ = DummySetupEnviron()
     adapted = PluggableIndexNodeAdapter(index, environ)
     adapted.node = parseString(_ODDBALL_XML).documentElement # no raise
 def test_FieldIndex(self):
     from xml.dom.minidom import parseString
     from Products.PluginIndexes.FieldIndex.FieldIndex import FieldIndex
     from Products.GenericSetup.testing import DummySetupEnviron
     from Products.GenericSetup.PluginIndexes.exportimport \
             import PluggableIndexNodeAdapter
     environ = DummySetupEnviron()
     def _no_clear(*a):
         raise AssertionError("Don't clear me!")
     index = FieldIndex('foo_field')
     index.indexed_attrs = ['bar']
     index.clear = _no_clear 
     adapted = PluggableIndexNodeAdapter(index, environ)
     adapted.node = parseString(_FIELD_XML).documentElement # no raise
예제 #3
0
    def test_OddballIndex(self):
        # Some indexes, e.g. Plone's 'GopipIndex', use ths adapter but don't
        # have 'indexed_attrs'.
        from xml.dom.minidom import parseString
        from Products.GenericSetup.testing import DummySetupEnviron
        from Products.GenericSetup.PluginIndexes.exportimport \
                import PluggableIndexNodeAdapter

        class Oddball(object):
            def clear(*a):
                raise AssertionError("Don't clear me!")

        index = Oddball()
        environ = DummySetupEnviron()
        adapted = PluggableIndexNodeAdapter(index, environ)
        adapted.node = parseString(_ODDBALL_XML).documentElement  # no raise
예제 #4
0
    def test_FieldIndex(self):
        from xml.dom.minidom import parseString
        from Products.PluginIndexes.FieldIndex.FieldIndex import FieldIndex
        from Products.GenericSetup.testing import DummySetupEnviron
        from Products.GenericSetup.PluginIndexes.exportimport \
                import PluggableIndexNodeAdapter
        environ = DummySetupEnviron()

        def _no_clear(*a):
            raise AssertionError("Don't clear me!")

        index = FieldIndex('foo_field')
        index.indexed_attrs = ['bar']
        index.clear = _no_clear
        adapted = PluggableIndexNodeAdapter(index, environ)
        adapted.node = parseString(_FIELD_XML).documentElement  # no raise