Commit 04488450 authored by Nicolas Delaby's avatar Nicolas Delaby

Follow new conversion cache storage typology (dictionary instead a list)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35275 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 36f2f76f
...@@ -253,19 +253,22 @@ class TestDocumentConversionCache(TestDocumentMixin): ...@@ -253,19 +253,22 @@ class TestDocumentConversionCache(TestDocumentMixin):
kw = {'format': 'html'} kw = {'format': 'html'}
#Generate one conversion #Generate one conversion
document.convert(**kw) document.convert(**kw)
cache_id = '%s%s' % (document._getCacheKey(), cache_id = document._getCacheKey(**kw)
document.generateCacheId(**kw))
cache_factory = document._getCacheFactory() cache_factory = document._getCacheFactory()
for cache_plugin in cache_factory.getCachePluginList(): for cache_plugin in cache_factory.getCachePluginList():
cache_entry = cache_plugin.get(cache_id, DEFAULT_CACHE_SCOPE) cache_entry = cache_plugin.get(cache_id, DEFAULT_CACHE_SCOPE)
md5sum, mime, data = cache_entry.getValue() data_dict = cache_entry.getValue()
#get data from cache #get data from cache
self.assertTrue(md5sum) self.assertTrue(data_dict['content_md5'])
self.assertTrue(mime) self.assertTrue(data_dict['conversion_md5'])
self.assertTrue(data) self.assertTrue(data_dict['mime'])
self.assertTrue(data_dict['data'])
self.assertTrue(data_dict['date'])
self.assertTrue(data_dict['size'])
#Change md5 manualy #Change md5 manualy
cache_plugin.set(cache_id, DEFAULT_CACHE_SCOPE, data_dict['content_md5'] = 'Anything which is not md5'
('Anything which is not md5', mime, data), 0, 0) cache_plugin.set(cache_id, DEFAULT_CACHE_SCOPE, data_dict, 100, 0)
transaction.commit()
self.assertRaises(KeyError, document.getConversion, format='html') self.assertRaises(KeyError, document.getConversion, format='html')
def test_06_check_md5_is_updated(self): def test_06_check_md5_is_updated(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment