def test_DateIndex(self):
     from xml.dom.minidom import parseString
     from Products.PluginIndexes.DateIndex.DateIndex import DateIndex
     from Products.GenericSetup.testing import DummySetupEnviron
     from Products.GenericSetup.PluginIndexes.exportimport \
             import DateIndexNodeAdapter
     environ = DummySetupEnviron()
     def _no_clear(*a):
         raise AssertionError("Don't clear me!")
     index = DateIndex('foo_date')
     index._setPropValue('index_naive_time_as_local', True)
     index.clear = _no_clear 
     adapted = DateIndexNodeAdapter(index, environ)
     adapted.node = parseString(_DATE_XML).documentElement # no raise
Ejemplo n.º 2
0
    def test_DateIndex(self):
        from xml.dom.minidom import parseString
        from Products.PluginIndexes.DateIndex.DateIndex import DateIndex
        from Products.GenericSetup.testing import DummySetupEnviron
        from Products.GenericSetup.PluginIndexes.exportimport \
                import DateIndexNodeAdapter
        environ = DummySetupEnviron()

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

        index = DateIndex('foo_date')
        index._setPropValue('index_naive_time_as_local', True)
        index.clear = _no_clear
        adapted = DateIndexNodeAdapter(index, environ)
        adapted.node = parseString(_DATE_XML).documentElement  # no raise
Ejemplo n.º 3
0
class DateIndexNodeAdapterTests(NodeAdapterTestCase, unittest.TestCase):

    layer = ExportImportZCMLLayer

    def _getTargetClass(self):
        from ..exportimport import DateIndexNodeAdapter
        return DateIndexNodeAdapter

    def setUp(self):
        from Products.PluginIndexes.DateIndex.DateIndex import DateIndex
        self._obj = DateIndex('foo_date')
        self._obj._setPropValue('precision', 0)
        self._XML = _DATE_XML

    def _verifyImport(self, obj):
        self.assertEqual(obj.id, 'foo_date')