From c5b49bc925e4cfb6f1efaf0610fff1efab1791e0 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Fri, 11 Sep 2009 14:29:53 +0000
Subject: [PATCH] Here we use edit instead of setFile, because only edit method
 set filename as source_reference. This is a feature related to
 portal_contribution, sometimes filename is replaced by value provided by
 rewriteIngestionData type based method. setFile should keep value provided by
 portal_contribution instead of reading it from file itself. See special
 parameter set_filename__ in EPR5.Tool.ContributionTool

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28977 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5OOo/tests/testDms.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/product/ERP5OOo/tests/testDms.py b/product/ERP5OOo/tests/testDms.py
index 0845b9e00e..de85ea5dec 100644
--- a/product/ERP5OOo/tests/testDms.py
+++ b/product/ERP5OOo/tests/testDms.py
@@ -790,8 +790,16 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional):
 
   def test_PDF_content_content_type(self):
     upload_file = makeFileUpload('REF-en-001.pdf')
-    document = self.portal.document_module.newContent(portal_type='PDF',
-                                                      file=upload_file)
+    document = self.portal.document_module.newContent(portal_type='PDF')
+    # Here we use edit instead of setFile,
+    # because only edit method set filename as source_reference.
+    # This is a feature related to portal_contribution,
+    # sometimes filename is replaced by value provided by
+    # rewriteIngestionData type based method.
+    # setFile should keep value provided by portal_contribution
+    # instead of reading it from file itself.
+    # See special parameter set_filename__ in EPR5.Tool.ContributionTool
+    document.edit(file=upload_file)
     self.assertEquals('application/pdf', document.getContentType())
 
 class TestDocumentWithSecurity(ERP5TypeTestCase):
-- 
2.30.9