From af695afaeef9c61624ebb830d4029c37927144b6 Mon Sep 17 00:00:00 2001 From: Julien Muchembled <jm@nexedi.com> Date: Tue, 9 Aug 2011 21:05:25 +0200 Subject: [PATCH] webdav: add unit test for upload of embedded file --- product/ERP5/tests/testWebDavSupport.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/product/ERP5/tests/testWebDavSupport.py b/product/ERP5/tests/testWebDavSupport.py index 08b92140f3..54a35a9ece 100644 --- a/product/ERP5/tests/testWebDavSupport.py +++ b/product/ERP5/tests/testWebDavSupport.py @@ -94,6 +94,24 @@ class TestWebDavSupport(ERP5TypeTestCase): def getWebPageModule(self): return self.portal.getDefaultModule('Web Page') + def test_PUT_embedded_file(self): + """Test a file can be uploaded on a document allowing embedded files + """ + person = self.portal.person_module.newContent() + transaction.commit() + self.tic() + file_object = makeFileUpload('images/erp5_logo.png') + response = self.publish(person.getPath() + '/erp5_logo.png', + request_method='PUT', + stdin=file_object, + basic=self.authentication) + self.assertEqual(response.getStatus(), httplib.CREATED) + image = person['erp5_logo.png'] + self.assertEqual(image.getPortalType(), 'Embedded File') + self.assertEqual(image.getContentType(), 'image/png') + file_object.seek(0) + self.assertEqual(image.getData(), file_object.read()) + def test_PUT_on_contributionTool(self): """Test Portal Contribution through Webdav calls Create a document -- 2.30.9