From cb291c23ac5533a9630f73f00ed1262035b27cd9 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Thu, 16 Jul 2009 07:52:44 +0000
Subject: [PATCH] Test that cache of temp objects are not mixed

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28084 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../ERP5OOo/tests/testOOoConversionCache.py   | 24 ++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/product/ERP5OOo/tests/testOOoConversionCache.py b/product/ERP5OOo/tests/testOOoConversionCache.py
index d848f6a82f..22947588df 100644
--- a/product/ERP5OOo/tests/testOOoConversionCache.py
+++ b/product/ERP5OOo/tests/testOOoConversionCache.py
@@ -171,11 +171,11 @@ class TestDocumentConversionCache(ERP5TypeTestCase, ZopeTestCase.Functional):
       self.assertTrue(document.hasConversion(format=format), 'Cache Storage failed for %s' % (format))
       self.assertTrue(document.getConversionSize(format=format))
 
-  def test_02_PersistentCacheConversionOfTempObject(self):
+  def test_02_VolatileCacheConversionOfTempObject(self):
     """
       Test Conversion Cache mechanism
     """
-    print '\nPersistent Cache Conversion Of Temp Objects'
+    print '\nVolatile Cache Conversion of temp objects'
 
     filename = 'TEST-en-002.doc'
     file = makeFileUpload(filename)
@@ -205,7 +205,25 @@ class TestDocumentConversionCache(ERP5TypeTestCase, ZopeTestCase.Functional):
       self.assertTrue(document.hasConversion(format=format), 'Cache Storage failed for %s' % (format))
       self.assertTrue(document.getConversionSize(format=format))
 
-
+  def test_03_CacheConversionOfTempObjectIsNotMixed(self):
+    """
+      Test Conversion Cache mechanism
+    """
+    print '\nCache Conversion of temp objects is not mixed'
+
+    filename1 = 'TEST-en-002.doc'
+    filename2 = 'TEST-en-002.odt'
+    file1 = makeFileUpload(filename1)
+    file2 = makeFileUpload(filename2)
+    document1 = self.portal.portal_contributions.newContent(file=file1, temp_object=1)
+    document1.convertToBaseFormat()
+    document2 = self.portal.portal_contributions.newContent(file=file2, temp_object=1)
+    document2.convertToBaseFormat()
+    format = 'pdf'
+    document1.convert(format=format)
+    document2.convert(format=format)
+    self.assertNotEqual(document1.getConversion(format=format),
+                        document2.getConversion(format=format))
 def test_suite():
   suite = unittest.TestSuite()
   suite.addTest(unittest.makeSuite(TestDocumentConversionCache))
-- 
2.30.9