コード例 #1
0
 def test_KeywordIndex(self):
     from xml.dom.minidom import parseString
     from Products.PluginIndexes.KeywordIndex.KeywordIndex \
             import KeywordIndex
     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 = KeywordIndex('foo_keyword')
     index.indexed_attrs = ['bar']
     index.clear = _no_clear 
     adapted = PluggableIndexNodeAdapter(index, environ)
     adapted.node = parseString(_KEYWORD_XML).documentElement # no raise
コード例 #2
0
    def test_KeywordIndex(self):
        from xml.dom.minidom import parseString
        from Products.PluginIndexes.KeywordIndex.KeywordIndex \
                import KeywordIndex
        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 = KeywordIndex('foo_keyword')
        index.indexed_attrs = ['bar']
        index.clear = _no_clear
        adapted = PluggableIndexNodeAdapter(index, environ)
        adapted.node = parseString(_KEYWORD_XML).documentElement  # no raise